blob: 9d580ab65de8f3851dea43c9a35d35226a9be02f [file] [log] [blame]
Dhruv Dhodyb5850122016-02-17 17:51:19 +05301/*
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 */
16package org.onosproject.ospf.controller.impl;
17
18import org.junit.After;
19import org.junit.Before;
20import org.junit.Test;
21import org.onlab.packet.Ip4Address;
22
23import static org.hamcrest.CoreMatchers.is;
24import static org.junit.Assert.assertThat;
25
26/**
27 * Unit test class for LinkInformationImpl.
28 */
29public class LinkInformationImplTest {
30
31 private LinkInformationImpl linkInformation;
32
33 @Before
34 public void setUp() throws Exception {
35 linkInformation = new LinkInformationImpl();
36 }
37
38 @After
39 public void tearDown() throws Exception {
40 linkInformation = null;
41 }
42
43 /**
44 * Tests linkId() getter method.
45 */
46 @Test
47 public void testLinkId() throws Exception {
48 linkInformation.setLinkId("1.1.1.1");
49 assertThat(linkInformation.linkId(), is("1.1.1.1"));
50 }
51
52 /**
53 * Tests linkId() setter method.
54 */
55 @Test
56 public void testSetLinkId() throws Exception {
57 linkInformation.setLinkId("1.1.1.1");
58 assertThat(linkInformation.linkId(), is("1.1.1.1"));
59 }
60
61 /**
62 * Tests isAlreadyCreated() getter method.
63 */
64 @Test
65 public void testIsAlreadyCreated() throws Exception {
66 linkInformation.setAlreadyCreated(true);
67 assertThat(linkInformation.isAlreadyCreated(), is(true));
68 }
69
70 /**
71 * Tests isAlreadyCreated() setter method.
72 */
73 @Test
74 public void testSetAlreadyCreated() throws Exception {
75 linkInformation.setAlreadyCreated(true);
76 assertThat(linkInformation.isAlreadyCreated(), is(true));
77 }
78
79 /**
80 * Tests isLinkSrcIdNotRouterId() getter method.
81 */
82 @Test
83 public void testIsLinkSrcIdNotRouterId() throws Exception {
84 linkInformation.setLinkSrcIdNotRouterId(true);
85 assertThat(linkInformation.isLinkSrcIdNotRouterId(), is(true));
86 }
87
88 /**
89 * Tests isLinkSrcIdNotRouterId() setter method.
90 */
91 @Test
92 public void testSetLinkSrcIdNotRouterId() throws Exception {
93 linkInformation.setLinkSrcIdNotRouterId(true);
94 assertThat(linkInformation.isLinkSrcIdNotRouterId(), is(true));
95 }
96
97 /**
98 * Tests linkDestinationId() getter method.
99 */
100 @Test
101 public void testLinkDestinationId() throws Exception {
102 linkInformation.setLinkDestinationId(Ip4Address.valueOf("1.1.1.1"));
103 assertThat(linkInformation.linkDestinationId(), is(Ip4Address.valueOf("1.1.1.1")));
104 }
105
106 /**
107 * Tests linkDestinationId() setter method.
108 */
109 @Test
110 public void testSetLinkDestinationId() throws Exception {
111 linkInformation.setLinkDestinationId(Ip4Address.valueOf("1.1.1.1"));
112 assertThat(linkInformation.linkDestinationId(), is(Ip4Address.valueOf("1.1.1.1")));
113 }
114
115 /**
116 * Tests linkSourceId() getter method.
117 */
118 @Test
119 public void testLinkSourceId() throws Exception {
120 linkInformation.setLinkSourceId(Ip4Address.valueOf("1.1.1.1"));
121 assertThat(linkInformation.linkSourceId(), is(Ip4Address.valueOf("1.1.1.1")));
122 }
123
124 /**
125 * Tests linkSourceId() setter method.
126 */
127 @Test
128 public void testSetLinkSourceId() throws Exception {
129 linkInformation.setLinkSourceId(Ip4Address.valueOf("1.1.1.1"));
130 assertThat(linkInformation.linkSourceId(), is(Ip4Address.valueOf("1.1.1.1")));
131 }
132
133 /**
134 * Tests interfaceIp() getter method.
135 */
136 @Test
137 public void testInterfaceIp() throws Exception {
138 linkInformation.setInterfaceIp(Ip4Address.valueOf("1.1.1.1"));
139 assertThat(linkInformation.interfaceIp(), is(Ip4Address.valueOf("1.1.1.1")));
140 }
141
142 /**
143 * Tests interfaceIp() setter method.
144 */
145 @Test
146 public void testSetInterfaceIp() throws Exception {
147 linkInformation.setInterfaceIp(Ip4Address.valueOf("1.1.1.1"));
148 assertThat(linkInformation.interfaceIp(), is(Ip4Address.valueOf("1.1.1.1")));
149 }
150
151 /**
152 * Tests linkSourceIpAddress() getter method.
153 */
154 @Test
155 public void testLinkSourceIpAddress() throws Exception {
156 linkInformation.setLinkSourceIpAddress(Ip4Address.valueOf("1.1.1.1"));
157 assertThat(linkInformation.linkSourceIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
158 }
159
160 /**
161 * Tests linkSourceIpAddress() setter method.
162 */
163 @Test
164 public void testSetLinkSourceIpAddress() throws Exception {
165 linkInformation.setLinkSourceIpAddress(Ip4Address.valueOf("1.1.1.1"));
166 assertThat(linkInformation.linkSourceIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
167 }
168
169 /**
170 * Tests linkDestinationId() getter method.
171 */
172 @Test
173 public void testLinkDestinationIpAddress() throws Exception {
174 linkInformation.setLinkDestinationIpAddress(Ip4Address.valueOf("1.1.1.1"));
175 assertThat(linkInformation.linkDestinationIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
176 }
177
178 /**
179 * Tests linkDestinationId() setter method.
180 */
181 @Test
182 public void testSetLinkDestinationIpAddress() throws Exception {
183 linkInformation.setLinkDestinationIpAddress(Ip4Address.valueOf("1.1.1.1"));
184 assertThat(linkInformation.linkDestinationIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
185 }
186}