blob: f77a3061d3c365453f12bfcccb21a7aab578c4fb [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;
21import org.onlab.packet.MacAddress;
22
23import static org.hamcrest.MatcherAssert.assertThat;
24import static org.hamcrest.Matchers.is;
25
26/**
27 * Unit tests for LispMacAddress class.
28 */
29public class LispMacAddressTest {
30
31 private LispMacAddress address1;
32 private LispMacAddress sameAsAddress1;
33 private LispMacAddress address2;
34
35 @Before
36 public void setup() {
37
38 address1 = new LispMacAddress(MacAddress.valueOf("00:00:00:00:00:01"));
39 sameAsAddress1 = new LispMacAddress(MacAddress.valueOf("00:00:00:00:00:01"));
40 address2 = new LispMacAddress(MacAddress.valueOf("00:00:00:00:00:02"));
41 }
42
43 @Test
44 public void testEquality() {
45 new EqualsTester()
46 .addEqualityGroup(address1, sameAsAddress1)
47 .addEqualityGroup(address2).testEquals();
48 }
49
50 @Test
51 public void testConstruction() {
52 LispMacAddress macAddress = address1;
53 assertThat(macAddress.getAddress(), is(MacAddress.valueOf("00:00:00:00:00:01")));
54 }
55}