blob: ad23c9a2bfacbd4ffca77565ace971d80aaf4ff4 [file] [log] [blame]
Ray Milkeyec253f82017-09-20 16:29:19 +09001/*
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 */
16package org.onosproject.net.behaviour;
17
18import org.junit.Test;
19
20import com.google.common.testing.EqualsTester;
21
22import static org.hamcrest.MatcherAssert.assertThat;
23import static org.hamcrest.Matchers.is;
24import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
25
26public class BridgeNameTest {
27
28 private static final String NAME1 = "bridge-1";
29 private static final String NAME2 = "bridge-2";
30 private BridgeName bridgeName1 = BridgeName.bridgeName(NAME1);
31 private BridgeName sameAsBridgeName1 = BridgeName.bridgeName(NAME1);
32 private BridgeName bridgeName2 = BridgeName.bridgeName(NAME2);
33
34 @Test
35 public void testImmutability() {
36 assertThatClassIsImmutable(BridgeName.class);
37 }
38
39 @Test
40 public void testConstruction() {
41 assertThat(bridgeName1.name(), is(NAME1));
42 }
43
44 @Test
45 public void testEquals() {
46 new EqualsTester()
47 .addEqualityGroup(bridgeName1, sameAsBridgeName1)
48 .addEqualityGroup(bridgeName2)
49 .testEquals();
50 }
51
52}