blob: 5e2d4a9eac0ea73ab15c0231c2f80e2b0bad63fd [file] [log] [blame]
Brian Stankeaa6211a2016-02-04 18:22:54 -05001/*
2 * Copyright 2016 Open Networking Laboratory
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
Claudine Chiu31ad5272016-02-17 20:56:24 +000017package org.onosproject.net.key;
Brian Stankeaa6211a2016-02-04 18:22:54 -050018
19import org.junit.Test;
20
21import static org.junit.Assert.*;
22import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
23
24/**
25 * Test class for CommunityName.
26 */
27public class CommunityNameTest {
28
29 final String cName = "CommunityName";
30
31 /**
32 * Checks that the CommunityName class is immutable.
33 */
34 @Test
35 public void testImmutability() {
36 assertThatClassIsImmutable(CommunityName.class);
37 }
38
39 /**
40 * Checks the construction of a community name object with a null
41 * value passed into it.
42 */
43 @Test
44 public void testCommunityNameNull() {
45 CommunityName communityName = CommunityName.communityName(null);
46
47 assertNotNull("The CommunityName should not be null.", communityName);
48 assertNull("The name should be null.", communityName.name());
49 }
50
51 /**
52 * Checks the construction of a community name object with a non-null
53 * value passed into it.
54 */
55 @Test
56 public void testCommunityName() {
57 CommunityName communityName = CommunityName.communityName(cName);
58
59 assertNotNull("The CommunityName should not be null.", communityName);
60 assertEquals("The name should match the expected value.", cName, communityName.name());
61 }
62}