Ray Milkey | 201f04b | 2017-09-25 10:13:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.net.behaviour; |
| 18 | |
| 19 | import org.junit.Test; |
| 20 | |
| 21 | import com.google.common.testing.EqualsTester; |
| 22 | |
| 23 | import static org.hamcrest.CoreMatchers.is; |
| 24 | import static org.hamcrest.MatcherAssert.assertThat; |
| 25 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 26 | |
| 27 | public class MirroringNameTest { |
| 28 | |
| 29 | private static final String NAME1 = "name1"; |
| 30 | private MirroringName name1 = MirroringName.mirroringName(NAME1); |
| 31 | private MirroringName sameAsName1 = MirroringName.mirroringName(NAME1); |
| 32 | private static final String NAME2 = "name2"; |
| 33 | private MirroringName name2 = MirroringName.mirroringName(NAME2); |
| 34 | |
| 35 | @Test |
| 36 | public void testImmutability() { |
| 37 | assertThatClassIsImmutable(MirroringName.class); |
| 38 | } |
| 39 | |
| 40 | @Test |
| 41 | public void testConstruction() { |
| 42 | assertThat(name1.name(), is(NAME1)); |
| 43 | } |
| 44 | |
| 45 | @Test |
| 46 | public void testEquals() { |
| 47 | new EqualsTester() |
| 48 | .addEqualityGroup(name1, sameAsName1) |
| 49 | .addEqualityGroup(name2) |
| 50 | .testEquals(); |
| 51 | } |
| 52 | } |