anjiaqi1234567 | 7cc5e71 | 2016-10-18 16:07:06 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 23c7e32 | 2017-08-03 18:48:27 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
anjiaqi1234567 | 7cc5e71 | 2016-10-18 16:07:06 +0800 | [diff] [blame] | 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 | package org.onosproject.nemo.model.common; |
| 17 | |
| 18 | import com.google.common.testing.EqualsTester; |
| 19 | import org.junit.Test; |
| 20 | |
| 21 | import static org.junit.Assert.assertEquals; |
| 22 | |
| 23 | /** |
| 24 | * Unit tests for {@link PropertyName}. |
| 25 | */ |
| 26 | public 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 | } |