blob: 0927e88bd64cb02b04d0d200a88768c00fafd353 [file] [log] [blame]
Mohamed Rahila3b9e992016-02-16 20:26:49 +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.protocol.lsa.subtypes;
17
18import org.junit.After;
19import org.junit.Before;
20import org.junit.Test;
21
22import static org.hamcrest.MatcherAssert.assertThat;
23import static org.hamcrest.Matchers.is;
24import static org.hamcrest.Matchers.notNullValue;
25
26/**
27 * Unit test class for OspfLsaLink.
28 */
29public class OspfLsaLinkTest {
30
31 private OspfLsaLink ospfLsaLink;
32
33 @Before
34 public void setUp() throws Exception {
35 ospfLsaLink = new OspfLsaLink();
36 }
37
38 @After
39 public void tearDown() throws Exception {
40 ospfLsaLink = null;
41 }
42
43 /**
44 * Tests linkId() getter method.
45 */
46 @Test
47 public void testGetLinkID() throws Exception {
48 ospfLsaLink.setLinkId("1.1.1.1");
49 assertThat(ospfLsaLink.linkId(), is("1.1.1.1"));
50 }
51
52 /**
53 * Tests linkId() setter method.
54 */
55 @Test
56 public void testSetLinkID() throws Exception {
57 ospfLsaLink.setLinkId("1.1.1.1");
58 assertThat(ospfLsaLink.linkId(), is("1.1.1.1"));
59 }
60
61 /**
62 * Tests linkData() getter method.
63 */
64 @Test
65 public void testGetLinkData() throws Exception {
66 ospfLsaLink.setLinkData("1.1.1.1");
67 assertThat(ospfLsaLink.linkData(), is("1.1.1.1"));
68 }
69
70 /**
71 * Tests linkData() setter method.
72 */
73 @Test
74 public void testSetLinkData() throws Exception {
75 ospfLsaLink.setLinkData("1.1.1.1");
76 assertThat(ospfLsaLink.linkData(), is("1.1.1.1"));
77 }
78
79 /**
80 * Tests linkType() getter method.
81 */
82 @Test
83 public void testGetLinkType() throws Exception {
84 ospfLsaLink.setLinkType(1);
85 assertThat(ospfLsaLink.linkType(), is(1));
86 }
87
88 /**
89 * Tests linkType() setter method.
90 */
91 @Test
92 public void testSetLinkType() throws Exception {
93 ospfLsaLink.setLinkType(1);
94 assertThat(ospfLsaLink.linkType(), is(1));
95 }
96
97 /**
98 * Tests metric() getter method.
99 */
100 @Test
101 public void testGetMetric() throws Exception {
102 ospfLsaLink.setMetric(100);
103 assertThat(ospfLsaLink.metric(), is(100));
104 }
105
106 /**
107 * Tests metric() setter method.
108 */
109 @Test
110 public void testSetMetric() throws Exception {
111 ospfLsaLink.setMetric(100);
112 assertThat(ospfLsaLink.metric(), is(100));
113 }
114
115 /**
116 * Tests tos() getter method.
117 */
118 @Test
119 public void testGetTos() throws Exception {
120 ospfLsaLink.setTos(100);
121 assertThat(ospfLsaLink.tos(), is(100));
122 }
123
124 /**
125 * Tests tos() setter method.
126 */
127 @Test
128 public void testSetTos() throws Exception {
129 ospfLsaLink.setTos(100);
130 assertThat(ospfLsaLink.tos(), is(100));
131 }
132
133 /**
134 * Tests to string method.
135 */
136 @Test
137 public void testToString() throws Exception {
138 assertThat(ospfLsaLink.toString(), is(notNullValue()));
139 }
140}