blob: 074b0caf270dddf1e31a3ff8cd6787dd518ccc07 [file] [log] [blame]
Jian Lie9af3b42016-08-08 15:50:01 +09001/*
2 * Copyright 2016-present 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 */
16package org.onosproject.lisp.msg.types;
17
18import com.google.common.testing.EqualsTester;
19import org.junit.Before;
20import org.junit.Test;
21
22import static org.hamcrest.MatcherAssert.assertThat;
23import static org.hamcrest.Matchers.is;
24
25/**
26 * Unit tests for LispDistinguishedNameAddress class.
27 */
28public class LispDistinguishedNameAddressTest {
29
30 private LispDistinguishedNameAddress address1;
31 private LispDistinguishedNameAddress sameAsAddress1;
32 private LispDistinguishedNameAddress address2;
33
34 @Before
35 public void setup() {
36
37 address1 = new LispDistinguishedNameAddress("distAddress1");
38 sameAsAddress1 = new LispDistinguishedNameAddress("distAddress1");
39 address2 = new LispDistinguishedNameAddress("distAddress2");
40 }
41
42 @Test
43 public void testEquality() {
44 new EqualsTester()
45 .addEqualityGroup(address1, sameAsAddress1)
46 .addEqualityGroup(address2).testEquals();
47 }
48
49 @Test
50 public void testConstruction() {
51 LispDistinguishedNameAddress distinguishedNameAddress = address1;
52
53 assertThat(distinguishedNameAddress.getDistinguishedName(), is("distAddress1"));
54 }
55}