blob: a0740eb4f6d7204f5949f4de2b8a9d1ea9ff1d6a [file] [log] [blame]
anjiaqi12345677cc5e712016-10-18 16:07:06 +08001/*
Brian O'Connor23c7e322017-08-03 18:48:27 -07002 * Copyright 2016-present Open Networking Foundation
anjiaqi12345677cc5e712016-10-18 16:07:06 +08003 *
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.nemo.model.common;
17
18import com.google.common.testing.EqualsTester;
19import org.junit.Test;
20
21import static org.junit.Assert.assertEquals;
22
23/**
24 * Unit tests for {@link PropertyName}.
25 */
26public class PropertyNameTest {
27
28 private static final String NAME = "SomeName";
29 private static final String OTHER = "OtherName";
30
31 private PropertyName name;
32 private PropertyName copy;
33 private PropertyName diff;
34
35 @Test
36 public void fromString() {
37 name = new PropertyName(NAME);
38 assertEquals("name not set", NAME, name.getValue());
39 }
40
41 @Test
42 public void copyConstructor() {
43 name = new PropertyName(NAME);
44 copy = new PropertyName(name);
45 new EqualsTester()
46 .addEqualityGroup(name, copy)
47 .testEquals();
48 }
49
50 @Test
51 public void equality() {
52 name = new PropertyName(NAME);
53 copy = new PropertyName(NAME);
54 diff = new PropertyName(OTHER);
55 new EqualsTester()
56 .addEqualityGroup(name, copy)
57 .addEqualityGroup(diff)
58 .testEquals();
59 }
60}