Committed by
Gerrit Code Review
UT for Pcep TE Report updated with assertThat
Change-Id: Iba408ef8fe321c9b7bdf3b5a5fb9f66f02c9ffa7
Showing
1 changed file
with
111 additions
and
157 deletions
... | @@ -17,7 +17,6 @@ package org.onosproject.pcepio; | ... | @@ -17,7 +17,6 @@ package org.onosproject.pcepio; |
17 | 17 | ||
18 | import org.jboss.netty.buffer.ChannelBuffer; | 18 | import org.jboss.netty.buffer.ChannelBuffer; |
19 | import org.jboss.netty.buffer.ChannelBuffers; | 19 | import org.jboss.netty.buffer.ChannelBuffers; |
20 | -import org.junit.Assert; | ||
21 | import org.junit.Test; | 20 | import org.junit.Test; |
22 | import org.onosproject.pcepio.exceptions.PcepParseException; | 21 | import org.onosproject.pcepio.exceptions.PcepParseException; |
23 | import org.onosproject.pcepio.protocol.PcepFactories; | 22 | import org.onosproject.pcepio.protocol.PcepFactories; |
... | @@ -25,26 +24,28 @@ import org.onosproject.pcepio.protocol.PcepMessage; | ... | @@ -25,26 +24,28 @@ import org.onosproject.pcepio.protocol.PcepMessage; |
25 | import org.onosproject.pcepio.protocol.PcepMessageReader; | 24 | import org.onosproject.pcepio.protocol.PcepMessageReader; |
26 | import org.onosproject.pcepio.protocol.PcepTEReportMsg; | 25 | import org.onosproject.pcepio.protocol.PcepTEReportMsg; |
27 | 26 | ||
27 | +import static org.hamcrest.MatcherAssert.assertThat; | ||
28 | +import static org.hamcrest.Matchers.instanceOf; | ||
29 | +import static org.hamcrest.core.Is.is; | ||
30 | + | ||
28 | public class PcepTEReportMsgTest { | 31 | public class PcepTEReportMsgTest { |
29 | 32 | ||
30 | /** | 33 | /** |
31 | * This test case checks for | 34 | * This test case checks for |
32 | * TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)). | 35 | * TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)). |
33 | * in PcTERpt message. | 36 | * in PcTERpt message. |
34 | - * | ||
35 | - * @throws PcepParseException while parsing PCEP message | ||
36 | */ | 37 | */ |
37 | @Test | 38 | @Test |
38 | public void teReportMessageTest1() throws PcepParseException { | 39 | public void teReportMessageTest1() throws PcepParseException { |
39 | 40 | ||
40 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header | 41 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header |
41 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header | 42 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header |
42 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 43 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
43 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 44 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
45 | 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV | 46 | 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV |
46 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv | 47 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv |
47 | - 0x00, 0x00, 0x00, 0x11 }; | 48 | + 0x00, 0x00, 0x00, 0x11}; |
48 | 49 | ||
49 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 50 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
50 | buffer.writeBytes(teReportMsg); | 51 | buffer.writeBytes(teReportMsg); |
... | @@ -55,35 +56,34 @@ public class PcepTEReportMsgTest { | ... | @@ -55,35 +56,34 @@ public class PcepTEReportMsgTest { |
55 | message = reader.readFrom(buffer); | 56 | message = reader.readFrom(buffer); |
56 | 57 | ||
57 | byte[] testReportMsg = {0}; | 58 | byte[] testReportMsg = {0}; |
58 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 59 | + |
60 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); | ||
59 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 61 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
60 | message.writeTo(buf); | 62 | message.writeTo(buf); |
61 | 63 | ||
62 | - int readLen = buf.writerIndex() - 0; | 64 | + int readLen = buf.writerIndex(); |
63 | testReportMsg = new byte[readLen]; | 65 | testReportMsg = new byte[readLen]; |
64 | buf.readBytes(testReportMsg, 0, readLen); | 66 | buf.readBytes(testReportMsg, 0, readLen); |
65 | 67 | ||
66 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 68 | + assertThat(testReportMsg, is(teReportMsg)); |
67 | } | 69 | } |
68 | 70 | ||
69 | /** | 71 | /** |
70 | * This test case checks for | 72 | * This test case checks for |
71 | - *T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID. | 73 | + * T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID. |
72 | * in PcTERpt message. | 74 | * in PcTERpt message. |
73 | - * | ||
74 | - * @throws PcepParseException while parsing PCEP message | ||
75 | */ | 75 | */ |
76 | @Test | 76 | @Test |
77 | public void teReportMessageTest2() throws PcepParseException { | 77 | public void teReportMessageTest2() throws PcepParseException { |
78 | 78 | ||
79 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header | 79 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header |
80 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header | 80 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header |
81 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 81 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
82 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 82 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
84 | 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV | 84 | 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV |
85 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | 85 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
86 | - 0x00, 0x00, 0x00, 0x11 }; | 86 | + 0x00, 0x00, 0x00, 0x11}; |
87 | 87 | ||
88 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 88 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
89 | buffer.writeBytes(teReportMsg); | 89 | buffer.writeBytes(teReportMsg); |
... | @@ -94,31 +94,29 @@ public class PcepTEReportMsgTest { | ... | @@ -94,31 +94,29 @@ public class PcepTEReportMsgTest { |
94 | message = reader.readFrom(buffer); | 94 | message = reader.readFrom(buffer); |
95 | 95 | ||
96 | byte[] testReportMsg = {0}; | 96 | byte[] testReportMsg = {0}; |
97 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 97 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
98 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 98 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
99 | message.writeTo(buf); | 99 | message.writeTo(buf); |
100 | 100 | ||
101 | - int readLen = buf.writerIndex() - 0; | 101 | + int readLen = buf.writerIndex(); |
102 | testReportMsg = new byte[readLen]; | 102 | testReportMsg = new byte[readLen]; |
103 | buf.readBytes(testReportMsg, 0, readLen); | 103 | buf.readBytes(testReportMsg, 0, readLen); |
104 | 104 | ||
105 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 105 | + assertThat(testReportMsg, is(teReportMsg)); |
106 | } | 106 | } |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * This test case checks for TE Object (Routing Universe TLV) | 109 | * This test case checks for TE Object (Routing Universe TLV) |
110 | * in PcTERpt message. | 110 | * in PcTERpt message. |
111 | - * | ||
112 | - * @throws PcepParseException while parsing PCEP message | ||
113 | */ | 111 | */ |
114 | @Test | 112 | @Test |
115 | public void teReportMessageTest3() throws PcepParseException { | 113 | public void teReportMessageTest3() throws PcepParseException { |
116 | 114 | ||
117 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x1c, // common header | 115 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x1c, // common header |
118 | 0x0E, 0x10, 0x00, 0x18, // TE Object Header | 116 | 0x0E, 0x10, 0x00, 0x18, // TE Object Header |
119 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 117 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
120 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 118 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
121 | - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; | 119 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; |
122 | 120 | ||
123 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 121 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
124 | buffer.writeBytes(teReportMsg); | 122 | buffer.writeBytes(teReportMsg); |
... | @@ -129,15 +127,15 @@ public class PcepTEReportMsgTest { | ... | @@ -129,15 +127,15 @@ public class PcepTEReportMsgTest { |
129 | message = reader.readFrom(buffer); | 127 | message = reader.readFrom(buffer); |
130 | 128 | ||
131 | byte[] testReportMsg = {0}; | 129 | byte[] testReportMsg = {0}; |
132 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 130 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
133 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 131 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
134 | message.writeTo(buf); | 132 | message.writeTo(buf); |
135 | 133 | ||
136 | - int readLen = buf.writerIndex() - 0; | 134 | + int readLen = buf.writerIndex(); |
137 | testReportMsg = new byte[readLen]; | 135 | testReportMsg = new byte[readLen]; |
138 | buf.readBytes(testReportMsg, 0, readLen); | 136 | buf.readBytes(testReportMsg, 0, readLen); |
139 | 137 | ||
140 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 138 | + assertThat(testReportMsg, is(teReportMsg)); |
141 | } | 139 | } |
142 | 140 | ||
143 | /** | 141 | /** |
... | @@ -145,13 +143,11 @@ public class PcepTEReportMsgTest { | ... | @@ -145,13 +143,11 @@ public class PcepTEReportMsgTest { |
145 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. | 143 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
146 | * OSPFareaIDsubTlv, RouterIDSubTlv)). | 144 | * OSPFareaIDsubTlv, RouterIDSubTlv)). |
147 | * in PcTERpt message. | 145 | * in PcTERpt message. |
148 | - * | ||
149 | - * @throws PcepParseException while parsing PCEP message | ||
150 | */ | 146 | */ |
151 | @Test | 147 | @Test |
152 | public void teReportMessageTest4() throws PcepParseException { | 148 | public void teReportMessageTest4() throws PcepParseException { |
153 | 149 | ||
154 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x44, // common header | 150 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x44, // common header |
155 | 0x0E, 0x10, 0x00, 0x40, // TE Object Header | 151 | 0x0E, 0x10, 0x00, 0x40, // TE Object Header |
156 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 152 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
157 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 153 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -177,15 +173,15 @@ public class PcepTEReportMsgTest { | ... | @@ -177,15 +173,15 @@ public class PcepTEReportMsgTest { |
177 | message = reader.readFrom(buffer); | 173 | message = reader.readFrom(buffer); |
178 | 174 | ||
179 | byte[] testReportMsg = {0}; | 175 | byte[] testReportMsg = {0}; |
180 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 176 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
181 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 177 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
182 | message.writeTo(buf); | 178 | message.writeTo(buf); |
183 | 179 | ||
184 | - int readLen = buf.writerIndex() - 0; | 180 | + int readLen = buf.writerIndex(); |
185 | testReportMsg = new byte[readLen]; | 181 | testReportMsg = new byte[readLen]; |
186 | buf.readBytes(testReportMsg, 0, readLen); | 182 | buf.readBytes(testReportMsg, 0, readLen); |
187 | 183 | ||
188 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 184 | + assertThat(testReportMsg, is(teReportMsg)); |
189 | } | 185 | } |
190 | 186 | ||
191 | /** | 187 | /** |
... | @@ -193,13 +189,11 @@ public class PcepTEReportMsgTest { | ... | @@ -193,13 +189,11 @@ public class PcepTEReportMsgTest { |
193 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv | 189 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv |
194 | * OSPFareaIDsubTlv, RouterIDSubTlv)) | 190 | * OSPFareaIDsubTlv, RouterIDSubTlv)) |
195 | * in PcTERpt message. | 191 | * in PcTERpt message. |
196 | - * | ||
197 | - * @throws PcepParseException while parsing PCEP message | ||
198 | */ | 192 | */ |
199 | @Test | 193 | @Test |
200 | public void teReportMessageTest5() throws PcepParseException { | 194 | public void teReportMessageTest5() throws PcepParseException { |
201 | 195 | ||
202 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x3C, // common header | 196 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x3C, // common header |
203 | 0x0E, 0x10, 0x00, 0x38, // TE Object Header | 197 | 0x0E, 0x10, 0x00, 0x38, // TE Object Header |
204 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 198 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
205 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 199 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -223,28 +217,26 @@ public class PcepTEReportMsgTest { | ... | @@ -223,28 +217,26 @@ public class PcepTEReportMsgTest { |
223 | message = reader.readFrom(buffer); | 217 | message = reader.readFrom(buffer); |
224 | 218 | ||
225 | byte[] testReportMsg = {0}; | 219 | byte[] testReportMsg = {0}; |
226 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 220 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
227 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 221 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
228 | message.writeTo(buf); | 222 | message.writeTo(buf); |
229 | 223 | ||
230 | - int readLen = buf.writerIndex() - 0; | 224 | + int readLen = buf.writerIndex(); |
231 | testReportMsg = new byte[readLen]; | 225 | testReportMsg = new byte[readLen]; |
232 | buf.readBytes(testReportMsg, 0, readLen); | 226 | buf.readBytes(testReportMsg, 0, readLen); |
233 | 227 | ||
234 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 228 | + assertThat(testReportMsg, is(teReportMsg)); |
235 | } | 229 | } |
236 | 230 | ||
237 | /** | 231 | /** |
238 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv, | 232 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv, |
239 | * RouterIDSubTlv)) | 233 | * RouterIDSubTlv)) |
240 | * in PcTERpt message. | 234 | * in PcTERpt message. |
241 | - * | ||
242 | - * @throws PcepParseException while parsing PCEP message | ||
243 | */ | 235 | */ |
244 | @Test | 236 | @Test |
245 | public void teReportMessageTest6() throws PcepParseException { | 237 | public void teReportMessageTest6() throws PcepParseException { |
246 | 238 | ||
247 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x34, // common header | 239 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x34, // common header |
248 | 0x0E, 0x10, 0x00, 0x30, // TE Object Header | 240 | 0x0E, 0x10, 0x00, 0x30, // TE Object Header |
249 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 241 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
250 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 242 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -266,27 +258,25 @@ public class PcepTEReportMsgTest { | ... | @@ -266,27 +258,25 @@ public class PcepTEReportMsgTest { |
266 | message = reader.readFrom(buffer); | 258 | message = reader.readFrom(buffer); |
267 | 259 | ||
268 | byte[] testReportMsg = {0}; | 260 | byte[] testReportMsg = {0}; |
269 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 261 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
270 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 262 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
271 | message.writeTo(buf); | 263 | message.writeTo(buf); |
272 | 264 | ||
273 | - int readLen = buf.writerIndex() - 0; | 265 | + int readLen = buf.writerIndex(); |
274 | testReportMsg = new byte[readLen]; | 266 | testReportMsg = new byte[readLen]; |
275 | buf.readBytes(testReportMsg, 0, readLen); | 267 | buf.readBytes(testReportMsg, 0, readLen); |
276 | 268 | ||
277 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 269 | + assertThat(testReportMsg, is(teReportMsg)); |
278 | } | 270 | } |
279 | 271 | ||
280 | /** | 272 | /** |
281 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)). | 273 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)). |
282 | * in PcTERpt message. | 274 | * in PcTERpt message. |
283 | - * | ||
284 | - * @throws PcepParseException while parsing PCEP message | ||
285 | */ | 275 | */ |
286 | @Test | 276 | @Test |
287 | public void teReportMessageTest7() throws PcepParseException { | 277 | public void teReportMessageTest7() throws PcepParseException { |
288 | 278 | ||
289 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x2C, // common header | 279 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x2C, // common header |
290 | 0x0E, 0x10, 0x00, 0x28, // TE Object Header | 280 | 0x0E, 0x10, 0x00, 0x28, // TE Object Header |
291 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 281 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
292 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 282 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -306,27 +296,25 @@ public class PcepTEReportMsgTest { | ... | @@ -306,27 +296,25 @@ public class PcepTEReportMsgTest { |
306 | message = reader.readFrom(buffer); | 296 | message = reader.readFrom(buffer); |
307 | 297 | ||
308 | byte[] testReportMsg = {0}; | 298 | byte[] testReportMsg = {0}; |
309 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 299 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
310 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 300 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
311 | message.writeTo(buf); | 301 | message.writeTo(buf); |
312 | 302 | ||
313 | - int readLen = buf.writerIndex() - 0; | 303 | + int readLen = buf.writerIndex(); |
314 | testReportMsg = new byte[readLen]; | 304 | testReportMsg = new byte[readLen]; |
315 | buf.readBytes(testReportMsg, 0, readLen); | 305 | buf.readBytes(testReportMsg, 0, readLen); |
316 | 306 | ||
317 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 307 | + assertThat(testReportMsg, is(teReportMsg)); |
318 | } | 308 | } |
319 | 309 | ||
320 | /** | 310 | /** |
321 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV) | 311 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV) |
322 | * in PcTERpt message. | 312 | * in PcTERpt message. |
323 | - * | ||
324 | - * @throws PcepParseException while parsing PCEP message | ||
325 | */ | 313 | */ |
326 | @Test | 314 | @Test |
327 | public void teReportMessageTest8() throws PcepParseException { | 315 | public void teReportMessageTest8() throws PcepParseException { |
328 | 316 | ||
329 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x20, // common header | 317 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x20, // common header |
330 | 0x0E, 0x10, 0x00, 0x1C, // TE Object Header | 318 | 0x0E, 0x10, 0x00, 0x1C, // TE Object Header |
331 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 319 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
332 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 320 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -344,15 +332,15 @@ public class PcepTEReportMsgTest { | ... | @@ -344,15 +332,15 @@ public class PcepTEReportMsgTest { |
344 | message = reader.readFrom(buffer); | 332 | message = reader.readFrom(buffer); |
345 | 333 | ||
346 | byte[] testReportMsg = {0}; | 334 | byte[] testReportMsg = {0}; |
347 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 335 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
348 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 336 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
349 | message.writeTo(buf); | 337 | message.writeTo(buf); |
350 | 338 | ||
351 | - int readLen = buf.writerIndex() - 0; | 339 | + int readLen = buf.writerIndex(); |
352 | testReportMsg = new byte[readLen]; | 340 | testReportMsg = new byte[readLen]; |
353 | buf.readBytes(testReportMsg, 0, readLen); | 341 | buf.readBytes(testReportMsg, 0, readLen); |
354 | 342 | ||
355 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 343 | + assertThat(testReportMsg, is(teReportMsg)); |
356 | } | 344 | } |
357 | 345 | ||
358 | /** | 346 | /** |
... | @@ -361,13 +349,11 @@ public class PcepTEReportMsgTest { | ... | @@ -361,13 +349,11 @@ public class PcepTEReportMsgTest { |
361 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. | 349 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
362 | * OSPFareaIDsubTlv, RouterIDSubTlv)). | 350 | * OSPFareaIDsubTlv, RouterIDSubTlv)). |
363 | * in PcTERpt message. | 351 | * in PcTERpt message. |
364 | - * | ||
365 | - * @throws PcepParseException while parsing PCEP message | ||
366 | */ | 352 | */ |
367 | @Test | 353 | @Test |
368 | public void teReportMessageTest9() throws PcepParseException { | 354 | public void teReportMessageTest9() throws PcepParseException { |
369 | 355 | ||
370 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x6C, // common header | 356 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x6C, // common header |
371 | 0x0E, 0x10, 0x00, 0x68, // TE Object Header | 357 | 0x0E, 0x10, 0x00, 0x68, // TE Object Header |
372 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 358 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
373 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 359 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -404,15 +390,15 @@ public class PcepTEReportMsgTest { | ... | @@ -404,15 +390,15 @@ public class PcepTEReportMsgTest { |
404 | message = reader.readFrom(buffer); | 390 | message = reader.readFrom(buffer); |
405 | 391 | ||
406 | byte[] testReportMsg = {0}; | 392 | byte[] testReportMsg = {0}; |
407 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 393 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
408 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 394 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
409 | message.writeTo(buf); | 395 | message.writeTo(buf); |
410 | 396 | ||
411 | - int readLen = buf.writerIndex() - 0; | 397 | + int readLen = buf.writerIndex(); |
412 | testReportMsg = new byte[readLen]; | 398 | testReportMsg = new byte[readLen]; |
413 | buf.readBytes(testReportMsg, 0, readLen); | 399 | buf.readBytes(testReportMsg, 0, readLen); |
414 | 400 | ||
415 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 401 | + assertThat(testReportMsg, is(teReportMsg)); |
416 | } | 402 | } |
417 | 403 | ||
418 | /** | 404 | /** |
... | @@ -421,13 +407,11 @@ public class PcepTEReportMsgTest { | ... | @@ -421,13 +407,11 @@ public class PcepTEReportMsgTest { |
421 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv | 407 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv |
422 | * OSPFareaIDsubTlv, RouterIDSubTlv)) | 408 | * OSPFareaIDsubTlv, RouterIDSubTlv)) |
423 | * in PcTERpt message. | 409 | * in PcTERpt message. |
424 | - * | ||
425 | - * @throws PcepParseException while parsing PCEP message | ||
426 | */ | 410 | */ |
427 | @Test | 411 | @Test |
428 | public void teReportMessageTest10() throws PcepParseException { | 412 | public void teReportMessageTest10() throws PcepParseException { |
429 | 413 | ||
430 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x64, // common header | 414 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x64, // common header |
431 | 0x0E, 0x10, 0x00, 0x60, // TE Object Header | 415 | 0x0E, 0x10, 0x00, 0x60, // TE Object Header |
432 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 416 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
433 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 417 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -462,15 +446,15 @@ public class PcepTEReportMsgTest { | ... | @@ -462,15 +446,15 @@ public class PcepTEReportMsgTest { |
462 | message = reader.readFrom(buffer); | 446 | message = reader.readFrom(buffer); |
463 | 447 | ||
464 | byte[] testReportMsg = {0}; | 448 | byte[] testReportMsg = {0}; |
465 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 449 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
466 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 450 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
467 | message.writeTo(buf); | 451 | message.writeTo(buf); |
468 | 452 | ||
469 | - int readLen = buf.writerIndex() - 0; | 453 | + int readLen = buf.writerIndex(); |
470 | testReportMsg = new byte[readLen]; | 454 | testReportMsg = new byte[readLen]; |
471 | buf.readBytes(testReportMsg, 0, readLen); | 455 | buf.readBytes(testReportMsg, 0, readLen); |
472 | 456 | ||
473 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 457 | + assertThat(testReportMsg, is(teReportMsg)); |
474 | } | 458 | } |
475 | 459 | ||
476 | /** | 460 | /** |
... | @@ -478,13 +462,11 @@ public class PcepTEReportMsgTest { | ... | @@ -478,13 +462,11 @@ public class PcepTEReportMsgTest { |
478 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | 462 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
479 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv)) | 463 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv)) |
480 | * in PcTERpt message. | 464 | * in PcTERpt message. |
481 | - * | ||
482 | - * @throws PcepParseException while parsing PCEP message | ||
483 | */ | 465 | */ |
484 | @Test | 466 | @Test |
485 | public void teReportMessageTest11() throws PcepParseException { | 467 | public void teReportMessageTest11() throws PcepParseException { |
486 | 468 | ||
487 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x5C, // common header | 469 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x5C, // common header |
488 | 0x0E, 0x10, 0x00, 0x58, // TE Object Header | 470 | 0x0E, 0x10, 0x00, 0x58, // TE Object Header |
489 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 471 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
490 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 472 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -517,15 +499,15 @@ public class PcepTEReportMsgTest { | ... | @@ -517,15 +499,15 @@ public class PcepTEReportMsgTest { |
517 | message = reader.readFrom(buffer); | 499 | message = reader.readFrom(buffer); |
518 | 500 | ||
519 | byte[] testReportMsg = {0}; | 501 | byte[] testReportMsg = {0}; |
520 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 502 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
521 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 503 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
522 | message.writeTo(buf); | 504 | message.writeTo(buf); |
523 | 505 | ||
524 | - int readLen = buf.writerIndex() - 0; | 506 | + int readLen = buf.writerIndex(); |
525 | testReportMsg = new byte[readLen]; | 507 | testReportMsg = new byte[readLen]; |
526 | buf.readBytes(testReportMsg, 0, readLen); | 508 | buf.readBytes(testReportMsg, 0, readLen); |
527 | 509 | ||
528 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 510 | + assertThat(testReportMsg, is(teReportMsg)); |
529 | } | 511 | } |
530 | 512 | ||
531 | /** | 513 | /** |
... | @@ -533,13 +515,11 @@ public class PcepTEReportMsgTest { | ... | @@ -533,13 +515,11 @@ public class PcepTEReportMsgTest { |
533 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | 515 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
534 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv)) | 516 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv)) |
535 | * in PcTERpt message. | 517 | * in PcTERpt message. |
536 | - * | ||
537 | - * @throws PcepParseException while parsing PCEP message | ||
538 | */ | 518 | */ |
539 | @Test | 519 | @Test |
540 | public void teReportMessageTest12() throws PcepParseException { | 520 | public void teReportMessageTest12() throws PcepParseException { |
541 | 521 | ||
542 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x54, // common header | 522 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x54, // common header |
543 | 0x0E, 0x10, 0x00, 0x50, // TE Object Header | 523 | 0x0E, 0x10, 0x00, 0x50, // TE Object Header |
544 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 524 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
545 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 525 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -570,15 +550,15 @@ public class PcepTEReportMsgTest { | ... | @@ -570,15 +550,15 @@ public class PcepTEReportMsgTest { |
570 | message = reader.readFrom(buffer); | 550 | message = reader.readFrom(buffer); |
571 | 551 | ||
572 | byte[] testReportMsg = {0}; | 552 | byte[] testReportMsg = {0}; |
573 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 553 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
574 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 554 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
575 | message.writeTo(buf); | 555 | message.writeTo(buf); |
576 | 556 | ||
577 | - int readLen = buf.writerIndex() - 0; | 557 | + int readLen = buf.writerIndex(); |
578 | testReportMsg = new byte[readLen]; | 558 | testReportMsg = new byte[readLen]; |
579 | buf.readBytes(testReportMsg, 0, readLen); | 559 | buf.readBytes(testReportMsg, 0, readLen); |
580 | 560 | ||
581 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 561 | + assertThat(testReportMsg, is(teReportMsg)); |
582 | } | 562 | } |
583 | 563 | ||
584 | /** | 564 | /** |
... | @@ -586,13 +566,11 @@ public class PcepTEReportMsgTest { | ... | @@ -586,13 +566,11 @@ public class PcepTEReportMsgTest { |
586 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | 566 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
587 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV) | 567 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV) |
588 | * in PcTERpt message. | 568 | * in PcTERpt message. |
589 | - * | ||
590 | - * @throws PcepParseException while parsing PCEP message | ||
591 | */ | 569 | */ |
592 | @Test | 570 | @Test |
593 | public void teReportMessageTest13() throws PcepParseException { | 571 | public void teReportMessageTest13() throws PcepParseException { |
594 | 572 | ||
595 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x48, // common header | 573 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x48, // common header |
596 | 0x0E, 0x10, 0x00, 0x44, // TE Object Header | 574 | 0x0E, 0x10, 0x00, 0x44, // TE Object Header |
597 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 575 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
598 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 576 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -620,15 +598,15 @@ public class PcepTEReportMsgTest { | ... | @@ -620,15 +598,15 @@ public class PcepTEReportMsgTest { |
620 | message = reader.readFrom(buffer); | 598 | message = reader.readFrom(buffer); |
621 | 599 | ||
622 | byte[] testReportMsg = {0}; | 600 | byte[] testReportMsg = {0}; |
623 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 601 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
624 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 602 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
625 | message.writeTo(buf); | 603 | message.writeTo(buf); |
626 | 604 | ||
627 | - int readLen = buf.writerIndex() - 0; | 605 | + int readLen = buf.writerIndex(); |
628 | testReportMsg = new byte[readLen]; | 606 | testReportMsg = new byte[readLen]; |
629 | buf.readBytes(testReportMsg, 0, readLen); | 607 | buf.readBytes(testReportMsg, 0, readLen); |
630 | 608 | ||
631 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 609 | + assertThat(testReportMsg, is(teReportMsg)); |
632 | } | 610 | } |
633 | 611 | ||
634 | /** | 612 | /** |
... | @@ -638,13 +616,11 @@ public class PcepTEReportMsgTest { | ... | @@ -638,13 +616,11 @@ public class PcepTEReportMsgTest { |
638 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | 616 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
639 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) | 617 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
640 | * in PcTERpt message. | 618 | * in PcTERpt message. |
641 | - * | ||
642 | - * @throws PcepParseException while parsing PCEP message | ||
643 | */ | 619 | */ |
644 | @Test | 620 | @Test |
645 | public void teReportMessageTest14() throws PcepParseException { | 621 | public void teReportMessageTest14() throws PcepParseException { |
646 | 622 | ||
647 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x8C, // common header | 623 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x8C, // common header |
648 | 0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header | 624 | 0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header |
649 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 625 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
650 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 626 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -689,15 +665,15 @@ public class PcepTEReportMsgTest { | ... | @@ -689,15 +665,15 @@ public class PcepTEReportMsgTest { |
689 | message = reader.readFrom(buffer); | 665 | message = reader.readFrom(buffer); |
690 | 666 | ||
691 | byte[] testReportMsg = {0}; | 667 | byte[] testReportMsg = {0}; |
692 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 668 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
693 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 669 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
694 | message.writeTo(buf); | 670 | message.writeTo(buf); |
695 | 671 | ||
696 | - int readLen = buf.writerIndex() - 0; | 672 | + int readLen = buf.writerIndex(); |
697 | testReportMsg = new byte[readLen]; | 673 | testReportMsg = new byte[readLen]; |
698 | buf.readBytes(testReportMsg, 0, readLen); | 674 | buf.readBytes(testReportMsg, 0, readLen); |
699 | 675 | ||
700 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 676 | + assertThat(testReportMsg, is(teReportMsg)); |
701 | } | 677 | } |
702 | 678 | ||
703 | /** | 679 | /** |
... | @@ -707,13 +683,11 @@ public class PcepTEReportMsgTest { | ... | @@ -707,13 +683,11 @@ public class PcepTEReportMsgTest { |
707 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV( | 683 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV( |
708 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) | 684 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
709 | * in PcTERpt message. | 685 | * in PcTERpt message. |
710 | - * | ||
711 | - * @throws PcepParseException while parsing PCEP message | ||
712 | */ | 686 | */ |
713 | @Test | 687 | @Test |
714 | public void teReportMessageTest15() throws PcepParseException { | 688 | public void teReportMessageTest15() throws PcepParseException { |
715 | 689 | ||
716 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x80, // common header | 690 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x80, // common header |
717 | 0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header | 691 | 0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header |
718 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 692 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
719 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 693 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -755,15 +729,15 @@ public class PcepTEReportMsgTest { | ... | @@ -755,15 +729,15 @@ public class PcepTEReportMsgTest { |
755 | message = reader.readFrom(buffer); | 729 | message = reader.readFrom(buffer); |
756 | 730 | ||
757 | byte[] testReportMsg = {0}; | 731 | byte[] testReportMsg = {0}; |
758 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 732 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
759 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 733 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
760 | message.writeTo(buf); | 734 | message.writeTo(buf); |
761 | 735 | ||
762 | - int readLen = buf.writerIndex() - 0; | 736 | + int readLen = buf.writerIndex(); |
763 | testReportMsg = new byte[readLen]; | 737 | testReportMsg = new byte[readLen]; |
764 | buf.readBytes(testReportMsg, 0, readLen); | 738 | buf.readBytes(testReportMsg, 0, readLen); |
765 | 739 | ||
766 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 740 | + assertThat(testReportMsg, is(teReportMsg)); |
767 | } | 741 | } |
768 | 742 | ||
769 | /** | 743 | /** |
... | @@ -772,13 +746,11 @@ public class PcepTEReportMsgTest { | ... | @@ -772,13 +746,11 @@ public class PcepTEReportMsgTest { |
772 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | 746 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
773 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv)) | 747 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv)) |
774 | * in PcTERpt message. | 748 | * in PcTERpt message. |
775 | - * | ||
776 | - * @throws PcepParseException while parsing PCEP message | ||
777 | */ | 749 | */ |
778 | @Test | 750 | @Test |
779 | public void teReportMessageTest16() throws PcepParseException { | 751 | public void teReportMessageTest16() throws PcepParseException { |
780 | 752 | ||
781 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x78, // common header | 753 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x78, // common header |
782 | 0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header | 754 | 0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header |
783 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 755 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
784 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 756 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -818,15 +790,15 @@ public class PcepTEReportMsgTest { | ... | @@ -818,15 +790,15 @@ public class PcepTEReportMsgTest { |
818 | message = reader.readFrom(buffer); | 790 | message = reader.readFrom(buffer); |
819 | 791 | ||
820 | byte[] testReportMsg = {0}; | 792 | byte[] testReportMsg = {0}; |
821 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 793 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
822 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 794 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
823 | message.writeTo(buf); | 795 | message.writeTo(buf); |
824 | 796 | ||
825 | - int readLen = buf.writerIndex() - 0; | 797 | + int readLen = buf.writerIndex(); |
826 | testReportMsg = new byte[readLen]; | 798 | testReportMsg = new byte[readLen]; |
827 | buf.readBytes(testReportMsg, 0, readLen); | 799 | buf.readBytes(testReportMsg, 0, readLen); |
828 | 800 | ||
829 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 801 | + assertThat(testReportMsg, is(teReportMsg)); |
830 | } | 802 | } |
831 | 803 | ||
832 | /** | 804 | /** |
... | @@ -835,13 +807,11 @@ public class PcepTEReportMsgTest { | ... | @@ -835,13 +807,11 @@ public class PcepTEReportMsgTest { |
835 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | 807 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
836 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV) | 808 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV) |
837 | * in PcTERpt message. | 809 | * in PcTERpt message. |
838 | - * | ||
839 | - * @throws PcepParseException while parsing PCEP message | ||
840 | */ | 810 | */ |
841 | @Test | 811 | @Test |
842 | public void teReportMessageTest17() throws PcepParseException { | 812 | public void teReportMessageTest17() throws PcepParseException { |
843 | 813 | ||
844 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x70, // common header | 814 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x70, // common header |
845 | 0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header | 815 | 0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header |
846 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 816 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
847 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 817 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -879,15 +849,15 @@ public class PcepTEReportMsgTest { | ... | @@ -879,15 +849,15 @@ public class PcepTEReportMsgTest { |
879 | message = reader.readFrom(buffer); | 849 | message = reader.readFrom(buffer); |
880 | 850 | ||
881 | byte[] testReportMsg = {0}; | 851 | byte[] testReportMsg = {0}; |
882 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 852 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
883 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 853 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
884 | message.writeTo(buf); | 854 | message.writeTo(buf); |
885 | 855 | ||
886 | - int readLen = buf.writerIndex() - 0; | 856 | + int readLen = buf.writerIndex(); |
887 | testReportMsg = new byte[readLen]; | 857 | testReportMsg = new byte[readLen]; |
888 | buf.readBytes(testReportMsg, 0, readLen); | 858 | buf.readBytes(testReportMsg, 0, readLen); |
889 | 859 | ||
890 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 860 | + assertThat(testReportMsg, is(teReportMsg)); |
891 | } | 861 | } |
892 | 862 | ||
893 | /** | 863 | /** |
... | @@ -897,13 +867,11 @@ public class PcepTEReportMsgTest { | ... | @@ -897,13 +867,11 @@ public class PcepTEReportMsgTest { |
897 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | 867 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
898 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) | 868 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
899 | * in PcTERpt message. | 869 | * in PcTERpt message. |
900 | - * | ||
901 | - * @throws PcepParseException while parsing PCEP message | ||
902 | */ | 870 | */ |
903 | @Test | 871 | @Test |
904 | public void teReportMessageTest18() throws PcepParseException { | 872 | public void teReportMessageTest18() throws PcepParseException { |
905 | 873 | ||
906 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header | 874 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header |
907 | 0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header | 875 | 0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header |
908 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 876 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
909 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 877 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -961,15 +929,15 @@ public class PcepTEReportMsgTest { | ... | @@ -961,15 +929,15 @@ public class PcepTEReportMsgTest { |
961 | message = reader.readFrom(buffer); | 929 | message = reader.readFrom(buffer); |
962 | 930 | ||
963 | byte[] testReportMsg = {0}; | 931 | byte[] testReportMsg = {0}; |
964 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 932 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
965 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 933 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
966 | message.writeTo(buf); | 934 | message.writeTo(buf); |
967 | 935 | ||
968 | - int readLen = buf.writerIndex() - 0; | 936 | + int readLen = buf.writerIndex(); |
969 | testReportMsg = new byte[readLen]; | 937 | testReportMsg = new byte[readLen]; |
970 | buf.readBytes(testReportMsg, 0, readLen); | 938 | buf.readBytes(testReportMsg, 0, readLen); |
971 | 939 | ||
972 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 940 | + assertThat(testReportMsg, is(teReportMsg)); |
973 | } | 941 | } |
974 | 942 | ||
975 | /** | 943 | /** |
... | @@ -980,13 +948,11 @@ public class PcepTEReportMsgTest { | ... | @@ -980,13 +948,11 @@ public class PcepTEReportMsgTest { |
980 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv | 948 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
981 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) | 949 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
982 | * in PcTERpt message. | 950 | * in PcTERpt message. |
983 | - * | ||
984 | - * @throws PcepParseException while parsing PCEP message | ||
985 | */ | 951 | */ |
986 | @Test | 952 | @Test |
987 | public void teReportMessageTest19() throws PcepParseException { | 953 | public void teReportMessageTest19() throws PcepParseException { |
988 | 954 | ||
989 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header | 955 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header |
990 | 0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header | 956 | 0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header |
991 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 957 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
992 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 958 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -1044,15 +1010,15 @@ public class PcepTEReportMsgTest { | ... | @@ -1044,15 +1010,15 @@ public class PcepTEReportMsgTest { |
1044 | message = reader.readFrom(buffer); | 1010 | message = reader.readFrom(buffer); |
1045 | 1011 | ||
1046 | byte[] testReportMsg = {0}; | 1012 | byte[] testReportMsg = {0}; |
1047 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 1013 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
1048 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1014 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1049 | message.writeTo(buf); | 1015 | message.writeTo(buf); |
1050 | 1016 | ||
1051 | - int readLen = buf.writerIndex() - 0; | 1017 | + int readLen = buf.writerIndex(); |
1052 | testReportMsg = new byte[readLen]; | 1018 | testReportMsg = new byte[readLen]; |
1053 | buf.readBytes(testReportMsg, 0, readLen); | 1019 | buf.readBytes(testReportMsg, 0, readLen); |
1054 | 1020 | ||
1055 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 1021 | + assertThat(testReportMsg, is(teReportMsg)); |
1056 | } | 1022 | } |
1057 | 1023 | ||
1058 | /** | 1024 | /** |
... | @@ -1061,15 +1027,13 @@ public class PcepTEReportMsgTest { | ... | @@ -1061,15 +1027,13 @@ public class PcepTEReportMsgTest { |
1061 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | 1027 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
1062 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | 1028 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
1063 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv | 1029 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv |
1064 | - * NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) | 1030 | + * NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
1065 | * in PcTERpt message. | 1031 | * in PcTERpt message. |
1066 | - * | ||
1067 | - * @throws PcepParseException while parsing PCEP message | ||
1068 | */ | 1032 | */ |
1069 | @Test | 1033 | @Test |
1070 | public void teReportMessageTest20() throws PcepParseException { | 1034 | public void teReportMessageTest20() throws PcepParseException { |
1071 | 1035 | ||
1072 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xB8, // common header | 1036 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xB8, // common header |
1073 | 0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header | 1037 | 0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header |
1074 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 1038 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
1075 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 1039 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -1125,15 +1089,15 @@ public class PcepTEReportMsgTest { | ... | @@ -1125,15 +1089,15 @@ public class PcepTEReportMsgTest { |
1125 | message = reader.readFrom(buffer); | 1089 | message = reader.readFrom(buffer); |
1126 | 1090 | ||
1127 | byte[] testReportMsg = {0}; | 1091 | byte[] testReportMsg = {0}; |
1128 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 1092 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
1129 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1093 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1130 | message.writeTo(buf); | 1094 | message.writeTo(buf); |
1131 | 1095 | ||
1132 | - int readLen = buf.writerIndex() - 0; | 1096 | + int readLen = buf.writerIndex(); |
1133 | testReportMsg = new byte[readLen]; | 1097 | testReportMsg = new byte[readLen]; |
1134 | buf.readBytes(testReportMsg, 0, readLen); | 1098 | buf.readBytes(testReportMsg, 0, readLen); |
1135 | 1099 | ||
1136 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 1100 | + assertThat(testReportMsg, is(teReportMsg)); |
1137 | } | 1101 | } |
1138 | 1102 | ||
1139 | /** | 1103 | /** |
... | @@ -1142,15 +1106,13 @@ public class PcepTEReportMsgTest { | ... | @@ -1142,15 +1106,13 @@ public class PcepTEReportMsgTest { |
1142 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | 1106 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
1143 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. | 1107 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. |
1144 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv | 1108 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv |
1145 | - * ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) | 1109 | + * ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
1146 | * in PcTERpt message. | 1110 | * in PcTERpt message. |
1147 | - * | ||
1148 | - * @throws PcepParseException while parsing PCEP message | ||
1149 | */ | 1111 | */ |
1150 | @Test | 1112 | @Test |
1151 | public void teReportMessageTest21() throws PcepParseException { | 1113 | public void teReportMessageTest21() throws PcepParseException { |
1152 | 1114 | ||
1153 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xAC, // common header | 1115 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xAC, // common header |
1154 | 0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header | 1116 | 0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header |
1155 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 1117 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
1156 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 1118 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -1203,15 +1165,15 @@ public class PcepTEReportMsgTest { | ... | @@ -1203,15 +1165,15 @@ public class PcepTEReportMsgTest { |
1203 | message = reader.readFrom(buffer); | 1165 | message = reader.readFrom(buffer); |
1204 | 1166 | ||
1205 | byte[] testReportMsg = {0}; | 1167 | byte[] testReportMsg = {0}; |
1206 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 1168 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
1207 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1169 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1208 | message.writeTo(buf); | 1170 | message.writeTo(buf); |
1209 | 1171 | ||
1210 | - int readLen = buf.writerIndex() - 0; | 1172 | + int readLen = buf.writerIndex(); |
1211 | testReportMsg = new byte[readLen]; | 1173 | testReportMsg = new byte[readLen]; |
1212 | buf.readBytes(testReportMsg, 0, readLen); | 1174 | buf.readBytes(testReportMsg, 0, readLen); |
1213 | 1175 | ||
1214 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 1176 | + assertThat(testReportMsg, is(teReportMsg)); |
1215 | } | 1177 | } |
1216 | 1178 | ||
1217 | /** | 1179 | /** |
... | @@ -1226,13 +1188,11 @@ public class PcepTEReportMsgTest { | ... | @@ -1226,13 +1188,11 @@ public class PcepTEReportMsgTest { |
1226 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv. | 1188 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv. |
1227 | * OpaqueLinkAttributeTlv, LinkNameTlv)). | 1189 | * OpaqueLinkAttributeTlv, LinkNameTlv)). |
1228 | * in PcTERpt message. | 1190 | * in PcTERpt message. |
1229 | - * | ||
1230 | - * @throws PcepParseException while parsing PCEP message | ||
1231 | */ | 1191 | */ |
1232 | @Test | 1192 | @Test |
1233 | public void teReportMessageTest22() throws PcepParseException { | 1193 | public void teReportMessageTest22() throws PcepParseException { |
1234 | 1194 | ||
1235 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x20, // common header | 1195 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x20, // common header |
1236 | 0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header | 1196 | 0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header |
1237 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 1197 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
1238 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 1198 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -1314,15 +1274,15 @@ public class PcepTEReportMsgTest { | ... | @@ -1314,15 +1274,15 @@ public class PcepTEReportMsgTest { |
1314 | message = reader.readFrom(buffer); | 1274 | message = reader.readFrom(buffer); |
1315 | 1275 | ||
1316 | byte[] testReportMsg = {0}; | 1276 | byte[] testReportMsg = {0}; |
1317 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 1277 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
1318 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1278 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1319 | message.writeTo(buf); | 1279 | message.writeTo(buf); |
1320 | 1280 | ||
1321 | - int readLen = buf.writerIndex() - 0; | 1281 | + int readLen = buf.writerIndex(); |
1322 | testReportMsg = new byte[readLen]; | 1282 | testReportMsg = new byte[readLen]; |
1323 | buf.readBytes(testReportMsg, 0, readLen); | 1283 | buf.readBytes(testReportMsg, 0, readLen); |
1324 | 1284 | ||
1325 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 1285 | + assertThat(testReportMsg, is(teReportMsg)); |
1326 | } | 1286 | } |
1327 | 1287 | ||
1328 | /** | 1288 | /** |
... | @@ -1337,13 +1297,11 @@ public class PcepTEReportMsgTest { | ... | @@ -1337,13 +1297,11 @@ public class PcepTEReportMsgTest { |
1337 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv | 1297 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv |
1338 | * OpaqueLinkAttributeTlv)) | 1298 | * OpaqueLinkAttributeTlv)) |
1339 | * in PcTERpt message. | 1299 | * in PcTERpt message. |
1340 | - * | ||
1341 | - * @throws PcepParseException while parsing PCEP message | ||
1342 | */ | 1300 | */ |
1343 | @Test | 1301 | @Test |
1344 | public void teReportMessageTest23() throws PcepParseException { | 1302 | public void teReportMessageTest23() throws PcepParseException { |
1345 | 1303 | ||
1346 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x18, // common header | 1304 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x18, // common header |
1347 | 0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header | 1305 | 0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header |
1348 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 1306 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
1349 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 1307 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -1423,15 +1381,15 @@ public class PcepTEReportMsgTest { | ... | @@ -1423,15 +1381,15 @@ public class PcepTEReportMsgTest { |
1423 | message = reader.readFrom(buffer); | 1381 | message = reader.readFrom(buffer); |
1424 | 1382 | ||
1425 | byte[] testReportMsg = {0}; | 1383 | byte[] testReportMsg = {0}; |
1426 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 1384 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
1427 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1385 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1428 | message.writeTo(buf); | 1386 | message.writeTo(buf); |
1429 | 1387 | ||
1430 | - int readLen = buf.writerIndex() - 0; | 1388 | + int readLen = buf.writerIndex(); |
1431 | testReportMsg = new byte[readLen]; | 1389 | testReportMsg = new byte[readLen]; |
1432 | buf.readBytes(testReportMsg, 0, readLen); | 1390 | buf.readBytes(testReportMsg, 0, readLen); |
1433 | 1391 | ||
1434 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 1392 | + assertThat(testReportMsg, is(teReportMsg)); |
1435 | } | 1393 | } |
1436 | 1394 | ||
1437 | /** | 1395 | /** |
... | @@ -1445,13 +1403,11 @@ public class PcepTEReportMsgTest { | ... | @@ -1445,13 +1403,11 @@ public class PcepTEReportMsgTest { |
1445 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv | 1403 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
1446 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv)) | 1404 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv)) |
1447 | * in PcTERpt message. | 1405 | * in PcTERpt message. |
1448 | - * | ||
1449 | - * @throws PcepParseException while parsing PCEP message | ||
1450 | */ | 1406 | */ |
1451 | @Test | 1407 | @Test |
1452 | public void teReportMessageTest24() throws PcepParseException { | 1408 | public void teReportMessageTest24() throws PcepParseException { |
1453 | 1409 | ||
1454 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x10, // common header | 1410 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x10, // common header |
1455 | 0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header | 1411 | 0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header |
1456 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 1412 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
1457 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 1413 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -1529,15 +1485,15 @@ public class PcepTEReportMsgTest { | ... | @@ -1529,15 +1485,15 @@ public class PcepTEReportMsgTest { |
1529 | message = reader.readFrom(buffer); | 1485 | message = reader.readFrom(buffer); |
1530 | 1486 | ||
1531 | byte[] testReportMsg = {0}; | 1487 | byte[] testReportMsg = {0}; |
1532 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 1488 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
1533 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1489 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1534 | message.writeTo(buf); | 1490 | message.writeTo(buf); |
1535 | 1491 | ||
1536 | - int readLen = buf.writerIndex() - 0; | 1492 | + int readLen = buf.writerIndex(); |
1537 | testReportMsg = new byte[readLen]; | 1493 | testReportMsg = new byte[readLen]; |
1538 | buf.readBytes(testReportMsg, 0, readLen); | 1494 | buf.readBytes(testReportMsg, 0, readLen); |
1539 | 1495 | ||
1540 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 1496 | + assertThat(testReportMsg, is(teReportMsg)); |
1541 | } | 1497 | } |
1542 | 1498 | ||
1543 | /** | 1499 | /** |
... | @@ -1551,13 +1507,11 @@ public class PcepTEReportMsgTest { | ... | @@ -1551,13 +1507,11 @@ public class PcepTEReportMsgTest { |
1551 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv | 1507 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
1552 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv)) | 1508 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv)) |
1553 | * in PcTERpt message. | 1509 | * in PcTERpt message. |
1554 | - * | ||
1555 | - * @throws PcepParseException while parsing PCEP message | ||
1556 | */ | 1510 | */ |
1557 | @Test | 1511 | @Test |
1558 | public void teReportMessageTest25() throws PcepParseException { | 1512 | public void teReportMessageTest25() throws PcepParseException { |
1559 | 1513 | ||
1560 | - byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, 0x04, // common header | 1514 | + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, 0x04, // common header |
1561 | 0x0E, 0x10, 0x01, 0x00, // TE Object Header | 1515 | 0x0E, 0x10, 0x01, 0x00, // TE Object Header |
1562 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | 1516 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
1563 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | 1517 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
... | @@ -1633,14 +1587,14 @@ public class PcepTEReportMsgTest { | ... | @@ -1633,14 +1587,14 @@ public class PcepTEReportMsgTest { |
1633 | 1587 | ||
1634 | byte[] testReportMsg = {0}; | 1588 | byte[] testReportMsg = {0}; |
1635 | 1589 | ||
1636 | - Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | 1590 | + assertThat(message, instanceOf(PcepTEReportMsg.class)); |
1637 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1591 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1638 | message.writeTo(buf); | 1592 | message.writeTo(buf); |
1639 | 1593 | ||
1640 | - int readLen = buf.writerIndex() - 0; | 1594 | + int readLen = buf.writerIndex(); |
1641 | testReportMsg = new byte[readLen]; | 1595 | testReportMsg = new byte[readLen]; |
1642 | buf.readBytes(testReportMsg, 0, readLen); | 1596 | buf.readBytes(testReportMsg, 0, readLen); |
1643 | 1597 | ||
1644 | - Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | 1598 | + assertThat(testReportMsg, is(teReportMsg)); |
1645 | } | 1599 | } |
1646 | } | 1600 | } | ... | ... |
-
Please register or login to post a comment