Committed by
Ray Milkey
UT for Pcep Report message (updated with AssertThat).
Change-Id: Ieebfbc2c2e64165a6cf316e98d4a013bf1060547
Showing
2 changed files
with
208 additions
and
280 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,22 +24,24 @@ import org.onosproject.pcepio.protocol.PcepMessage; | ... | @@ -25,22 +24,24 @@ 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.PcepReportMsg; | 25 | import org.onosproject.pcepio.protocol.PcepReportMsg; |
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 PcepReportMsgTest { | 31 | public class PcepReportMsgTest { |
29 | 32 | ||
30 | /** | 33 | /** |
31 | * This test case checks for SRP object, LSP object(Symbolic path name tlv), ERO object | 34 | * This test case checks for SRP object, LSP object(Symbolic path name tlv), ERO object |
32 | * in PcRpt message. | 35 | * in PcRpt message. |
33 | - * | ||
34 | - * @throws PcepParseException while parsing PCEP message | ||
35 | */ | 36 | */ |
36 | @Test | 37 | @Test |
37 | public void reportMessageTest1() throws PcepParseException { | 38 | public void reportMessageTest1() throws PcepParseException { |
38 | 39 | ||
39 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, 0x24, | 40 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, 0x24, |
40 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 41 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
41 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 42 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
42 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 43 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
43 | - 0x07, 0x10, 0x00, 0x04 }; //ERO Object | 44 | + 0x07, 0x10, 0x00, 0x04}; //ERO Object |
44 | 45 | ||
45 | byte[] testReportMsg = {0}; | 46 | byte[] testReportMsg = {0}; |
46 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 47 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -51,29 +52,27 @@ public class PcepReportMsgTest { | ... | @@ -51,29 +52,27 @@ public class PcepReportMsgTest { |
51 | 52 | ||
52 | message = reader.readFrom(buffer); | 53 | message = reader.readFrom(buffer); |
53 | 54 | ||
54 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 55 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
55 | 56 | ||
56 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 57 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
57 | message.writeTo(buf); | 58 | message.writeTo(buf); |
58 | 59 | ||
59 | - int readLen = buf.writerIndex() - 0; | 60 | + int readLen = buf.writerIndex(); |
60 | testReportMsg = new byte[readLen]; | 61 | testReportMsg = new byte[readLen]; |
61 | buf.readBytes(testReportMsg, 0, readLen); | 62 | buf.readBytes(testReportMsg, 0, readLen); |
62 | 63 | ||
63 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 64 | + assertThat(testReportMsg, is(reportMsg)); |
64 | } | 65 | } |
65 | 66 | ||
66 | /** | 67 | /** |
67 | * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv | 68 | * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv |
68 | * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list, IRO object | 69 | * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list, IRO object |
69 | * in PcRpt message. | 70 | * in PcRpt message. |
70 | - * | ||
71 | - * @throws PcepParseException while parsing PCEP message | ||
72 | */ | 71 | */ |
73 | @Test | 72 | @Test |
74 | public void reportMessageTest2() throws PcepParseException { | 73 | public void reportMessageTest2() throws PcepParseException { |
75 | 74 | ||
76 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x7c, | 75 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7c, |
77 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 76 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
78 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object // LSP Object | 77 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object // LSP Object |
79 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 78 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
... | @@ -84,7 +83,7 @@ public class PcepReportMsgTest { | ... | @@ -84,7 +83,7 @@ public class PcepReportMsgTest { |
84 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 83 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
85 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // IPv4SubObjects | 84 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // IPv4SubObjects |
86 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 85 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
87 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 86 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
89 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Object | 88 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Object |
90 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 89 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -99,28 +98,26 @@ public class PcepReportMsgTest { | ... | @@ -99,28 +98,26 @@ public class PcepReportMsgTest { |
99 | 98 | ||
100 | message = reader.readFrom(buffer); | 99 | message = reader.readFrom(buffer); |
101 | 100 | ||
102 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 101 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
103 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 102 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
104 | message.writeTo(buf); | 103 | message.writeTo(buf); |
105 | 104 | ||
106 | - int readLen = buf.writerIndex() - 0; | 105 | + int readLen = buf.writerIndex(); |
107 | testReportMsg = new byte[readLen]; | 106 | testReportMsg = new byte[readLen]; |
108 | buf.readBytes(testReportMsg, 0, readLen); | 107 | buf.readBytes(testReportMsg, 0, readLen); |
109 | 108 | ||
110 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 109 | + assertThat(testReportMsg, is(reportMsg)); |
111 | } | 110 | } |
112 | 111 | ||
113 | /** | 112 | /** |
114 | * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) | 113 | * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) |
115 | * ERO Object, LSPA Object, Metric-list, IRO object | 114 | * ERO Object, LSPA Object, Metric-list, IRO object |
116 | * in PcRpt message. | 115 | * in PcRpt message. |
117 | - * | ||
118 | - * @throws PcepParseException while parsing PCEP message | ||
119 | */ | 116 | */ |
120 | @Test | 117 | @Test |
121 | public void reportMessageTest3() throws PcepParseException { | 118 | public void reportMessageTest3() throws PcepParseException { |
122 | 119 | ||
123 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70, | 120 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, |
124 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | 121 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
125 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 122 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
126 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 123 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -130,7 +127,7 @@ public class PcepReportMsgTest { | ... | @@ -130,7 +127,7 @@ public class PcepReportMsgTest { |
130 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 127 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
131 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects | 128 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects |
132 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 129 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
133 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 130 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
134 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
135 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects | 132 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects |
136 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 133 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -145,28 +142,26 @@ public class PcepReportMsgTest { | ... | @@ -145,28 +142,26 @@ public class PcepReportMsgTest { |
145 | 142 | ||
146 | message = reader.readFrom(buffer); | 143 | message = reader.readFrom(buffer); |
147 | 144 | ||
148 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 145 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
149 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 146 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
150 | message.writeTo(buf); | 147 | message.writeTo(buf); |
151 | 148 | ||
152 | - int readLen = buf.writerIndex() - 0; | 149 | + int readLen = buf.writerIndex(); |
153 | testReportMsg = new byte[readLen]; | 150 | testReportMsg = new byte[readLen]; |
154 | buf.readBytes(testReportMsg, 0, readLen); | 151 | buf.readBytes(testReportMsg, 0, readLen); |
155 | 152 | ||
156 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 153 | + assertThat(testReportMsg, is(reportMsg)); |
157 | } | 154 | } |
158 | 155 | ||
159 | /** | 156 | /** |
160 | * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) | 157 | * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) |
161 | * ERO Object, LSPA Object, Metric-list | 158 | * ERO Object, LSPA Object, Metric-list |
162 | * in PcRpt message. | 159 | * in PcRpt message. |
163 | - * | ||
164 | - * @throws PcepParseException while parsing PCEP message | ||
165 | */ | 160 | */ |
166 | @Test | 161 | @Test |
167 | public void reportMessageTest4() throws PcepParseException { | 162 | public void reportMessageTest4() throws PcepParseException { |
168 | 163 | ||
169 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x64, | 164 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x64, |
170 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 165 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
171 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | 166 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
172 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 167 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
... | @@ -177,8 +172,8 @@ public class PcepReportMsgTest { | ... | @@ -177,8 +172,8 @@ public class PcepReportMsgTest { |
177 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 172 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
178 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 173 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
179 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 174 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
180 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 175 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
181 | - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 176 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
182 | 177 | ||
183 | byte[] testReportMsg = {0}; | 178 | byte[] testReportMsg = {0}; |
184 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 179 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -189,28 +184,26 @@ public class PcepReportMsgTest { | ... | @@ -189,28 +184,26 @@ public class PcepReportMsgTest { |
189 | 184 | ||
190 | message = reader.readFrom(buffer); | 185 | message = reader.readFrom(buffer); |
191 | 186 | ||
192 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 187 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
193 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 188 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
194 | message.writeTo(buf); | 189 | message.writeTo(buf); |
195 | 190 | ||
196 | - int readLen = buf.writerIndex() - 0; | 191 | + int readLen = buf.writerIndex(); |
197 | testReportMsg = new byte[readLen]; | 192 | testReportMsg = new byte[readLen]; |
198 | buf.readBytes(testReportMsg, 0, readLen); | 193 | buf.readBytes(testReportMsg, 0, readLen); |
199 | 194 | ||
200 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 195 | + assertThat(testReportMsg, is(reportMsg)); |
201 | } | 196 | } |
202 | 197 | ||
203 | /** | 198 | /** |
204 | * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv | 199 | * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv |
205 | * StatefulLspErrorCodeTlv) ERO Object, IRO object | 200 | * StatefulLspErrorCodeTlv) ERO Object, IRO object |
206 | * in PcRpt message. | 201 | * in PcRpt message. |
207 | - * | ||
208 | - * @throws PcepParseException while parsing PCEP message | ||
209 | */ | 202 | */ |
210 | @Test | 203 | @Test |
211 | public void reportMessageTest5() throws PcepParseException { | 204 | public void reportMessageTest5() throws PcepParseException { |
212 | 205 | ||
213 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x50, | 206 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x50, |
214 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 207 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
215 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | 208 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
216 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 209 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
... | @@ -220,7 +213,7 @@ public class PcepReportMsgTest { | ... | @@ -220,7 +213,7 @@ public class PcepReportMsgTest { |
220 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | 213 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
221 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 214 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
222 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 215 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
223 | - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 }; | 216 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; |
224 | 217 | ||
225 | byte[] testReportMsg = {0}; | 218 | byte[] testReportMsg = {0}; |
226 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 219 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -231,28 +224,26 @@ public class PcepReportMsgTest { | ... | @@ -231,28 +224,26 @@ public class PcepReportMsgTest { |
231 | 224 | ||
232 | message = reader.readFrom(buffer); | 225 | message = reader.readFrom(buffer); |
233 | 226 | ||
234 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 227 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
235 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 228 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
236 | message.writeTo(buf); | 229 | message.writeTo(buf); |
237 | 230 | ||
238 | - int readLen = buf.writerIndex() - 0; | 231 | + int readLen = buf.writerIndex(); |
239 | testReportMsg = new byte[readLen]; | 232 | testReportMsg = new byte[readLen]; |
240 | buf.readBytes(testReportMsg, 0, readLen); | 233 | buf.readBytes(testReportMsg, 0, readLen); |
241 | 234 | ||
242 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 235 | + assertThat(testReportMsg, is(reportMsg)); |
243 | } | 236 | } |
244 | 237 | ||
245 | /** | 238 | /** |
246 | * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv | 239 | * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv |
247 | * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list. | 240 | * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list. |
248 | * in PcRpt message. | 241 | * in PcRpt message. |
249 | - * | ||
250 | - * @throws PcepParseException while parsing PCEP message | ||
251 | */ | 242 | */ |
252 | @Test | 243 | @Test |
253 | public void reportMessageTest6() throws PcepParseException { | 244 | public void reportMessageTest6() throws PcepParseException { |
254 | 245 | ||
255 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6c, | 246 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, |
256 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 247 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
257 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 248 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
258 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 249 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
... | @@ -276,36 +267,34 @@ public class PcepReportMsgTest { | ... | @@ -276,36 +267,34 @@ public class PcepReportMsgTest { |
276 | 267 | ||
277 | message = reader.readFrom(buffer); | 268 | message = reader.readFrom(buffer); |
278 | 269 | ||
279 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 270 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
280 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 271 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
281 | message.writeTo(buf); | 272 | message.writeTo(buf); |
282 | 273 | ||
283 | - int readLen = buf.writerIndex() - 0; | 274 | + int readLen = buf.writerIndex(); |
284 | testReportMsg = new byte[readLen]; | 275 | testReportMsg = new byte[readLen]; |
285 | buf.readBytes(testReportMsg, 0, readLen); | 276 | buf.readBytes(testReportMsg, 0, readLen); |
286 | 277 | ||
287 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 278 | + assertThat(testReportMsg, is(reportMsg)); |
288 | } | 279 | } |
289 | 280 | ||
290 | /** | 281 | /** |
291 | * This test case checks for LSP Object, ERO Object, LSPA Object, Metric-list, IRO object | 282 | * This test case checks for LSP Object, ERO Object, LSPA Object, Metric-list, IRO object |
292 | * in PcRpt message. | 283 | * in PcRpt message. |
293 | - * | ||
294 | - * @throws PcepParseException while parsing PCEP message | ||
295 | */ | 284 | */ |
296 | @Test | 285 | @Test |
297 | public void reportMessageTest7() throws PcepParseException { | 286 | public void reportMessageTest7() throws PcepParseException { |
298 | 287 | ||
299 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x58, | 288 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, |
300 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 289 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
301 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | 290 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
302 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 291 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
303 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 292 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
304 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 293 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
305 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 294 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
306 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 295 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
307 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, // Metric objects | 296 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, // Metric objects |
308 | - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; | 297 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; |
309 | 298 | ||
310 | byte[] testReportMsg = {0}; | 299 | byte[] testReportMsg = {0}; |
311 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 300 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -316,28 +305,26 @@ public class PcepReportMsgTest { | ... | @@ -316,28 +305,26 @@ public class PcepReportMsgTest { |
316 | 305 | ||
317 | message = reader.readFrom(buffer); | 306 | message = reader.readFrom(buffer); |
318 | 307 | ||
319 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 308 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
320 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 309 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
321 | message.writeTo(buf); | 310 | message.writeTo(buf); |
322 | 311 | ||
323 | - int readLen = buf.writerIndex() - 0; | 312 | + int readLen = buf.writerIndex(); |
324 | testReportMsg = new byte[readLen]; | 313 | testReportMsg = new byte[readLen]; |
325 | buf.readBytes(testReportMsg, 0, readLen); | 314 | buf.readBytes(testReportMsg, 0, readLen); |
326 | 315 | ||
327 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 316 | + assertThat(testReportMsg, is(reportMsg)); |
328 | } | 317 | } |
329 | 318 | ||
330 | /** | 319 | /** |
331 | * This test case checks for SRP object, LSP object( StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, | 320 | * This test case checks for SRP object, LSP object( StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, |
332 | * StatefulLspErrorCodeTlv) ERO object, LSPA object, Metric object | 321 | * StatefulLspErrorCodeTlv) ERO object, LSPA object, Metric object |
333 | * in PcRpt message. | 322 | * in PcRpt message. |
334 | - * | ||
335 | - * @throws PcepParseException while parsing PCEP message | ||
336 | */ | 323 | */ |
337 | @Test | 324 | @Test |
338 | public void reportMessageTest8() throws PcepParseException { | 325 | public void reportMessageTest8() throws PcepParseException { |
339 | 326 | ||
340 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70, | 327 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, |
341 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 328 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
342 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 329 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
343 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 330 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
... | @@ -348,7 +335,7 @@ public class PcepReportMsgTest { | ... | @@ -348,7 +335,7 @@ public class PcepReportMsgTest { |
348 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 335 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
349 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 336 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
350 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 337 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
351 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 338 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
352 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 339 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
353 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object | 340 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object |
354 | 341 | ||
... | @@ -361,28 +348,26 @@ public class PcepReportMsgTest { | ... | @@ -361,28 +348,26 @@ public class PcepReportMsgTest { |
361 | 348 | ||
362 | message = reader.readFrom(buffer); | 349 | message = reader.readFrom(buffer); |
363 | 350 | ||
364 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 351 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
365 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 352 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
366 | message.writeTo(buf); | 353 | message.writeTo(buf); |
367 | 354 | ||
368 | - int readLen = buf.writerIndex() - 0; | 355 | + int readLen = buf.writerIndex(); |
369 | testReportMsg = new byte[readLen]; | 356 | testReportMsg = new byte[readLen]; |
370 | buf.readBytes(testReportMsg, 0, readLen); | 357 | buf.readBytes(testReportMsg, 0, readLen); |
371 | 358 | ||
372 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 359 | + assertThat(testReportMsg, is(reportMsg)); |
373 | } | 360 | } |
374 | 361 | ||
375 | /** | 362 | /** |
376 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, | 363 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, |
377 | * StatefulLspErrorCodeTlv ),ERO Object | 364 | * StatefulLspErrorCodeTlv ),ERO Object |
378 | * in PcRpt message. | 365 | * in PcRpt message. |
379 | - * | ||
380 | - * @throws PcepParseException while parsing PCEP message | ||
381 | */ | 366 | */ |
382 | @Test | 367 | @Test |
383 | public void reportMessageTest9() throws PcepParseException { | 368 | public void reportMessageTest9() throws PcepParseException { |
384 | 369 | ||
385 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x44, | 370 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, |
386 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | 371 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
387 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 372 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
388 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 373 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -391,7 +376,7 @@ public class PcepReportMsgTest { | ... | @@ -391,7 +376,7 @@ public class PcepReportMsgTest { |
391 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | 376 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
392 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 377 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
393 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 378 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
394 | - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 }; | 379 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; |
395 | 380 | ||
396 | byte[] testReportMsg = {0}; | 381 | byte[] testReportMsg = {0}; |
397 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 382 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -402,27 +387,25 @@ public class PcepReportMsgTest { | ... | @@ -402,27 +387,25 @@ public class PcepReportMsgTest { |
402 | 387 | ||
403 | message = reader.readFrom(buffer); | 388 | message = reader.readFrom(buffer); |
404 | 389 | ||
405 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 390 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
406 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 391 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
407 | message.writeTo(buf); | 392 | message.writeTo(buf); |
408 | 393 | ||
409 | - int readLen = buf.writerIndex() - 0; | 394 | + int readLen = buf.writerIndex(); |
410 | testReportMsg = new byte[readLen]; | 395 | testReportMsg = new byte[readLen]; |
411 | buf.readBytes(testReportMsg, 0, readLen); | 396 | buf.readBytes(testReportMsg, 0, readLen); |
412 | 397 | ||
413 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 398 | + assertThat(testReportMsg, is(reportMsg)); |
414 | } | 399 | } |
415 | 400 | ||
416 | /** | 401 | /** |
417 | * This test case checks for SRP Object,LSP Object(StatefulIPv4LspIdentidiersTlv)ERO Object,RRO Object | 402 | * This test case checks for SRP Object,LSP Object(StatefulIPv4LspIdentidiersTlv)ERO Object,RRO Object |
418 | * in PcRpt message. | 403 | * in PcRpt message. |
419 | - * | ||
420 | - * @throws PcepParseException while parsing PCEP message | ||
421 | */ | 404 | */ |
422 | @Test | 405 | @Test |
423 | public void reportMessageTest10() throws PcepParseException { | 406 | public void reportMessageTest10() throws PcepParseException { |
424 | 407 | ||
425 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74, | 408 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, |
426 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 409 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
427 | 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 410 | 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
428 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 411 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
... | @@ -436,7 +419,7 @@ public class PcepReportMsgTest { | ... | @@ -436,7 +419,7 @@ public class PcepReportMsgTest { |
436 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 419 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
437 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 420 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
438 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 421 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
439 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 422 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
440 | 423 | ||
441 | byte[] testReportMsg = {0}; | 424 | byte[] testReportMsg = {0}; |
442 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 425 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -447,27 +430,25 @@ public class PcepReportMsgTest { | ... | @@ -447,27 +430,25 @@ public class PcepReportMsgTest { |
447 | 430 | ||
448 | message = reader.readFrom(buffer); | 431 | message = reader.readFrom(buffer); |
449 | 432 | ||
450 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 433 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
451 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 434 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
452 | message.writeTo(buf); | 435 | message.writeTo(buf); |
453 | 436 | ||
454 | - int readLen = buf.writerIndex() - 0; | 437 | + int readLen = buf.writerIndex(); |
455 | testReportMsg = new byte[readLen]; | 438 | testReportMsg = new byte[readLen]; |
456 | buf.readBytes(testReportMsg, 0, readLen); | 439 | buf.readBytes(testReportMsg, 0, readLen); |
457 | 440 | ||
458 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 441 | + assertThat(testReportMsg, is(reportMsg)); |
459 | } | 442 | } |
460 | 443 | ||
461 | /** | 444 | /** |
462 | * This test case checks for SRP Object,LSP Object(SymbolicPathNameTlv)ERO Object,RRO Object | 445 | * This test case checks for SRP Object,LSP Object(SymbolicPathNameTlv)ERO Object,RRO Object |
463 | * in PcRpt message. | 446 | * in PcRpt message. |
464 | - * | ||
465 | - * @throws PcepParseException while parsing PCEP message | ||
466 | */ | 447 | */ |
467 | @Test | 448 | @Test |
468 | public void reportMessageTest11() throws PcepParseException { | 449 | public void reportMessageTest11() throws PcepParseException { |
469 | 450 | ||
470 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68, | 451 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, |
471 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 452 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
472 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 453 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
473 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 454 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
... | @@ -479,7 +460,7 @@ public class PcepReportMsgTest { | ... | @@ -479,7 +460,7 @@ public class PcepReportMsgTest { |
479 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 460 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
480 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 461 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
481 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 462 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
482 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 463 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
483 | 464 | ||
484 | byte[] testReportMsg = {0}; | 465 | byte[] testReportMsg = {0}; |
485 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 466 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -490,27 +471,25 @@ public class PcepReportMsgTest { | ... | @@ -490,27 +471,25 @@ public class PcepReportMsgTest { |
490 | 471 | ||
491 | message = reader.readFrom(buffer); | 472 | message = reader.readFrom(buffer); |
492 | 473 | ||
493 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 474 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
494 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 475 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
495 | message.writeTo(buf); | 476 | message.writeTo(buf); |
496 | 477 | ||
497 | - int readLen = buf.writerIndex() - 0; | 478 | + int readLen = buf.writerIndex(); |
498 | testReportMsg = new byte[readLen]; | 479 | testReportMsg = new byte[readLen]; |
499 | buf.readBytes(testReportMsg, 0, readLen); | 480 | buf.readBytes(testReportMsg, 0, readLen); |
500 | 481 | ||
501 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 482 | + assertThat(testReportMsg, is(reportMsg)); |
502 | } | 483 | } |
503 | 484 | ||
504 | /** | 485 | /** |
505 | * This test case checks for SRP Object,LSP Object, ERO Object,RRO Object | 486 | * This test case checks for SRP Object,LSP Object, ERO Object,RRO Object |
506 | * in PcRpt message. | 487 | * in PcRpt message. |
507 | - * | ||
508 | - * @throws PcepParseException while parsing PCEP message | ||
509 | */ | 488 | */ |
510 | @Test | 489 | @Test |
511 | public void reportMessageTest12() throws PcepParseException { | 490 | public void reportMessageTest12() throws PcepParseException { |
512 | 491 | ||
513 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x60, | 492 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, |
514 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 493 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
515 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | 494 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
516 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 495 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
... | @@ -521,7 +500,7 @@ public class PcepReportMsgTest { | ... | @@ -521,7 +500,7 @@ public class PcepReportMsgTest { |
521 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 500 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
522 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 501 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
523 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 502 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
524 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 503 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
525 | 504 | ||
526 | byte[] testReportMsg = {0}; | 505 | byte[] testReportMsg = {0}; |
527 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 506 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -532,27 +511,25 @@ public class PcepReportMsgTest { | ... | @@ -532,27 +511,25 @@ public class PcepReportMsgTest { |
532 | 511 | ||
533 | message = reader.readFrom(buffer); | 512 | message = reader.readFrom(buffer); |
534 | 513 | ||
535 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 514 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
536 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 515 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
537 | message.writeTo(buf); | 516 | message.writeTo(buf); |
538 | 517 | ||
539 | - int readLen = buf.writerIndex() - 0; | 518 | + int readLen = buf.writerIndex(); |
540 | testReportMsg = new byte[readLen]; | 519 | testReportMsg = new byte[readLen]; |
541 | buf.readBytes(testReportMsg, 0, readLen); | 520 | buf.readBytes(testReportMsg, 0, readLen); |
542 | 521 | ||
543 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 522 | + assertThat(testReportMsg, is(reportMsg)); |
544 | } | 523 | } |
545 | 524 | ||
546 | /** | 525 | /** |
547 | * This test case checks for SRP Object,LSP Object(StatefulLspErrorCodeTlv)ERO Object,RRO Object | 526 | * This test case checks for SRP Object,LSP Object(StatefulLspErrorCodeTlv)ERO Object,RRO Object |
548 | * in PcRpt message. | 527 | * in PcRpt message. |
549 | - * | ||
550 | - * @throws PcepParseException while parsing PCEP message | ||
551 | */ | 528 | */ |
552 | @Test | 529 | @Test |
553 | public void reportMessageTest13() throws PcepParseException { | 530 | public void reportMessageTest13() throws PcepParseException { |
554 | 531 | ||
555 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68, | 532 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, |
556 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 533 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
557 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 534 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
558 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | 535 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
... | @@ -564,7 +541,7 @@ public class PcepReportMsgTest { | ... | @@ -564,7 +541,7 @@ public class PcepReportMsgTest { |
564 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 541 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
565 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 542 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
566 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 543 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
567 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 544 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
568 | 545 | ||
569 | byte[] testReportMsg = {0}; | 546 | byte[] testReportMsg = {0}; |
570 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 547 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -575,27 +552,25 @@ public class PcepReportMsgTest { | ... | @@ -575,27 +552,25 @@ public class PcepReportMsgTest { |
575 | 552 | ||
576 | message = reader.readFrom(buffer); | 553 | message = reader.readFrom(buffer); |
577 | 554 | ||
578 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 555 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
579 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 556 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
580 | message.writeTo(buf); | 557 | message.writeTo(buf); |
581 | 558 | ||
582 | - int readLen = buf.writerIndex() - 0; | 559 | + int readLen = buf.writerIndex(); |
583 | testReportMsg = new byte[readLen]; | 560 | testReportMsg = new byte[readLen]; |
584 | buf.readBytes(testReportMsg, 0, readLen); | 561 | buf.readBytes(testReportMsg, 0, readLen); |
585 | 562 | ||
586 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 563 | + assertThat(testReportMsg, is(reportMsg)); |
587 | } | 564 | } |
588 | 565 | ||
589 | /** | 566 | /** |
590 | * This test case checks for SRP Object,LSP Object(StatefulRsvpErrorSpecTlv),ERO Object,RRO Object | 567 | * This test case checks for SRP Object,LSP Object(StatefulRsvpErrorSpecTlv),ERO Object,RRO Object |
591 | * in PcRpt message. | 568 | * in PcRpt message. |
592 | - * | ||
593 | - * @throws PcepParseException while parsing PCEP message | ||
594 | */ | 569 | */ |
595 | @Test | 570 | @Test |
596 | public void reportMessageTest14() throws PcepParseException { | 571 | public void reportMessageTest14() throws PcepParseException { |
597 | 572 | ||
598 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x60, | 573 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, |
599 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 574 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
600 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | 575 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
601 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 576 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
... | @@ -606,7 +581,7 @@ public class PcepReportMsgTest { | ... | @@ -606,7 +581,7 @@ public class PcepReportMsgTest { |
606 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 581 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
607 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 582 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
608 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 583 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
609 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 584 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
610 | 585 | ||
611 | byte[] testReportMsg = {0}; | 586 | byte[] testReportMsg = {0}; |
612 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 587 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -617,41 +592,39 @@ public class PcepReportMsgTest { | ... | @@ -617,41 +592,39 @@ public class PcepReportMsgTest { |
617 | 592 | ||
618 | message = reader.readFrom(buffer); | 593 | message = reader.readFrom(buffer); |
619 | 594 | ||
620 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 595 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
621 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 596 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
622 | message.writeTo(buf); | 597 | message.writeTo(buf); |
623 | 598 | ||
624 | - int readLen = buf.writerIndex() - 0; | 599 | + int readLen = buf.writerIndex(); |
625 | testReportMsg = new byte[readLen]; | 600 | testReportMsg = new byte[readLen]; |
626 | buf.readBytes(testReportMsg, 0, readLen); | 601 | buf.readBytes(testReportMsg, 0, readLen); |
627 | 602 | ||
628 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 603 | + assertThat(testReportMsg, is(reportMsg)); |
629 | } | 604 | } |
630 | 605 | ||
631 | /** | 606 | /** |
632 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),LSPA Object,ERO Object | 607 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),LSPA Object,ERO Object |
633 | * in PcRpt message. | 608 | * in PcRpt message. |
634 | - * | ||
635 | - * @throws PcepParseException while parsing PCEP message | ||
636 | */ | 609 | */ |
637 | @Test | 610 | @Test |
638 | public void reportMessageTest15() throws PcepParseException { | 611 | public void reportMessageTest15() throws PcepParseException { |
639 | 612 | ||
640 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x7C, | 613 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7C, |
641 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 614 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
642 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 615 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
643 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 616 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
644 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 617 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
645 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 618 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
646 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 619 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
647 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 620 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
648 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 621 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
649 | 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | 622 | 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
650 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | 623 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
651 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 624 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
652 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 625 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
653 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 626 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
654 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 627 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
655 | 628 | ||
656 | byte[] testReportMsg = {0}; | 629 | byte[] testReportMsg = {0}; |
657 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 630 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -662,27 +635,25 @@ public class PcepReportMsgTest { | ... | @@ -662,27 +635,25 @@ public class PcepReportMsgTest { |
662 | 635 | ||
663 | message = reader.readFrom(buffer); | 636 | message = reader.readFrom(buffer); |
664 | 637 | ||
665 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 638 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
666 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 639 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
667 | message.writeTo(buf); | 640 | message.writeTo(buf); |
668 | 641 | ||
669 | - int readLen = buf.writerIndex() - 0; | 642 | + int readLen = buf.writerIndex(); |
670 | testReportMsg = new byte[readLen]; | 643 | testReportMsg = new byte[readLen]; |
671 | buf.readBytes(testReportMsg, 0, readLen); | 644 | buf.readBytes(testReportMsg, 0, readLen); |
672 | 645 | ||
673 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 646 | + assertThat(testReportMsg, is(reportMsg)); |
674 | } | 647 | } |
675 | 648 | ||
676 | /** | 649 | /** |
677 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),BandWidth Object,ERO Object | 650 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),BandWidth Object,ERO Object |
678 | * in PcRpt message. | 651 | * in PcRpt message. |
679 | - * | ||
680 | - * @throws PcepParseException while parsing PCEP message | ||
681 | */ | 652 | */ |
682 | @Test | 653 | @Test |
683 | public void reportMessageTest16() throws PcepParseException { | 654 | public void reportMessageTest16() throws PcepParseException { |
684 | 655 | ||
685 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70, | 656 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, |
686 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 657 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
687 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 658 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
688 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 659 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
... | @@ -695,7 +666,7 @@ public class PcepReportMsgTest { | ... | @@ -695,7 +666,7 @@ public class PcepReportMsgTest { |
695 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 666 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
696 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 667 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
697 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 668 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
698 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 669 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
699 | 670 | ||
700 | byte[] testReportMsg = {0}; | 671 | byte[] testReportMsg = {0}; |
701 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 672 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -706,40 +677,38 @@ public class PcepReportMsgTest { | ... | @@ -706,40 +677,38 @@ public class PcepReportMsgTest { |
706 | 677 | ||
707 | message = reader.readFrom(buffer); | 678 | message = reader.readFrom(buffer); |
708 | 679 | ||
709 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 680 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
710 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 681 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
711 | message.writeTo(buf); | 682 | message.writeTo(buf); |
712 | 683 | ||
713 | - int readLen = buf.writerIndex() - 0; | 684 | + int readLen = buf.writerIndex(); |
714 | testReportMsg = new byte[readLen]; | 685 | testReportMsg = new byte[readLen]; |
715 | buf.readBytes(testReportMsg, 0, readLen); | 686 | buf.readBytes(testReportMsg, 0, readLen); |
716 | 687 | ||
717 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 688 | + assertThat(testReportMsg, is(reportMsg)); |
718 | } | 689 | } |
719 | 690 | ||
720 | /** | 691 | /** |
721 | * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,RRO Object | 692 | * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,RRO Object |
722 | * in PcRpt message. | 693 | * in PcRpt message. |
723 | - * | ||
724 | - * @throws PcepParseException while parsing PCEP message | ||
725 | */ | 694 | */ |
726 | @Test | 695 | @Test |
727 | public void reportMessageTest17() throws PcepParseException { | 696 | public void reportMessageTest17() throws PcepParseException { |
728 | 697 | ||
729 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74, | 698 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, |
730 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 699 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
731 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | 700 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
732 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 701 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
733 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 702 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
734 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 703 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
735 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 704 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
736 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 705 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
737 | 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | 706 | 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
738 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | 707 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
739 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 708 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
740 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 709 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
741 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 710 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
742 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 711 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
743 | 712 | ||
744 | byte[] testReportMsg = {0}; | 713 | byte[] testReportMsg = {0}; |
745 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 714 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -750,27 +719,25 @@ public class PcepReportMsgTest { | ... | @@ -750,27 +719,25 @@ public class PcepReportMsgTest { |
750 | 719 | ||
751 | message = reader.readFrom(buffer); | 720 | message = reader.readFrom(buffer); |
752 | 721 | ||
753 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 722 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
754 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 723 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
755 | message.writeTo(buf); | 724 | message.writeTo(buf); |
756 | 725 | ||
757 | - int readLen = buf.writerIndex() - 0; | 726 | + int readLen = buf.writerIndex(); |
758 | testReportMsg = new byte[readLen]; | 727 | testReportMsg = new byte[readLen]; |
759 | buf.readBytes(testReportMsg, 0, readLen); | 728 | buf.readBytes(testReportMsg, 0, readLen); |
760 | 729 | ||
761 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 730 | + assertThat(testReportMsg, is(reportMsg)); |
762 | } | 731 | } |
763 | 732 | ||
764 | /** | 733 | /** |
765 | * This test case checks for SRP Object,LSP Object,ERO Object,BandWidth Object,RRO Object | 734 | * This test case checks for SRP Object,LSP Object,ERO Object,BandWidth Object,RRO Object |
766 | * in PcRpt message. | 735 | * in PcRpt message. |
767 | - * | ||
768 | - * @throws PcepParseException while parsing PCEP message | ||
769 | */ | 736 | */ |
770 | @Test | 737 | @Test |
771 | public void reportMessageTest18() throws PcepParseException { | 738 | public void reportMessageTest18() throws PcepParseException { |
772 | 739 | ||
773 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68, | 740 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, |
774 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 741 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
775 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | 742 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
776 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 743 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
... | @@ -782,7 +749,7 @@ public class PcepReportMsgTest { | ... | @@ -782,7 +749,7 @@ public class PcepReportMsgTest { |
782 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 749 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
783 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 750 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
784 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 751 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
785 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 752 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
786 | 753 | ||
787 | byte[] testReportMsg = {0}; | 754 | byte[] testReportMsg = {0}; |
788 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 755 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -793,27 +760,25 @@ public class PcepReportMsgTest { | ... | @@ -793,27 +760,25 @@ public class PcepReportMsgTest { |
793 | 760 | ||
794 | message = reader.readFrom(buffer); | 761 | message = reader.readFrom(buffer); |
795 | 762 | ||
796 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 763 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
797 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 764 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
798 | message.writeTo(buf); | 765 | message.writeTo(buf); |
799 | 766 | ||
800 | - int readLen = buf.writerIndex() - 0; | 767 | + int readLen = buf.writerIndex(); |
801 | testReportMsg = new byte[readLen]; | 768 | testReportMsg = new byte[readLen]; |
802 | buf.readBytes(testReportMsg, 0, readLen); | 769 | buf.readBytes(testReportMsg, 0, readLen); |
803 | 770 | ||
804 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 771 | + assertThat(testReportMsg, is(reportMsg)); |
805 | } | 772 | } |
806 | 773 | ||
807 | /** | 774 | /** |
808 | * This test case checks for SRP Object,LSP Object,ERO Object,Metric-list,RRO Object | 775 | * This test case checks for SRP Object,LSP Object,ERO Object,Metric-list,RRO Object |
809 | * in PcRpt message. | 776 | * in PcRpt message. |
810 | - * | ||
811 | - * @throws PcepParseException while parsing PCEP message | ||
812 | */ | 777 | */ |
813 | @Test | 778 | @Test |
814 | public void reportMessageTest19() throws PcepParseException { | 779 | public void reportMessageTest19() throws PcepParseException { |
815 | 780 | ||
816 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6C, | 781 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6C, |
817 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 782 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
818 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | 783 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
819 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 784 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
... | @@ -825,7 +790,7 @@ public class PcepReportMsgTest { | ... | @@ -825,7 +790,7 @@ public class PcepReportMsgTest { |
825 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 790 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
826 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 791 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
827 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 792 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
828 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 793 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
829 | 794 | ||
830 | byte[] testReportMsg = {0}; | 795 | byte[] testReportMsg = {0}; |
831 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 796 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -836,33 +801,31 @@ public class PcepReportMsgTest { | ... | @@ -836,33 +801,31 @@ public class PcepReportMsgTest { |
836 | 801 | ||
837 | message = reader.readFrom(buffer); | 802 | message = reader.readFrom(buffer); |
838 | 803 | ||
839 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 804 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
840 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 805 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
841 | message.writeTo(buf); | 806 | message.writeTo(buf); |
842 | 807 | ||
843 | - int readLen = buf.writerIndex() - 0; | 808 | + int readLen = buf.writerIndex(); |
844 | testReportMsg = new byte[readLen]; | 809 | testReportMsg = new byte[readLen]; |
845 | buf.readBytes(testReportMsg, 0, readLen); | 810 | buf.readBytes(testReportMsg, 0, readLen); |
846 | 811 | ||
847 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 812 | + assertThat(testReportMsg, is(reportMsg)); |
848 | } | 813 | } |
849 | 814 | ||
850 | /** | 815 | /** |
851 | * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | 816 | * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
852 | * in PcRpt message. | 817 | * in PcRpt message. |
853 | - * | ||
854 | - * @throws PcepParseException while parsing PCEP message | ||
855 | */ | 818 | */ |
856 | @Test | 819 | @Test |
857 | public void reportMessageTest20() throws PcepParseException { | 820 | public void reportMessageTest20() throws PcepParseException { |
858 | 821 | ||
859 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x88, | 822 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x88, |
860 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 823 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
861 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | 824 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
862 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 825 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
863 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 826 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
864 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 827 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
865 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | 828 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
866 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 829 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
867 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 830 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
868 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 831 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -871,7 +834,7 @@ public class PcepReportMsgTest { | ... | @@ -871,7 +834,7 @@ public class PcepReportMsgTest { |
871 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 834 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
872 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 835 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
873 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 836 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
874 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 837 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
875 | 838 | ||
876 | byte[] testReportMsg = {0}; | 839 | byte[] testReportMsg = {0}; |
877 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 840 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -882,27 +845,26 @@ public class PcepReportMsgTest { | ... | @@ -882,27 +845,26 @@ public class PcepReportMsgTest { |
882 | 845 | ||
883 | message = reader.readFrom(buffer); | 846 | message = reader.readFrom(buffer); |
884 | 847 | ||
885 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 848 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
886 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 849 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
887 | message.writeTo(buf); | 850 | message.writeTo(buf); |
888 | 851 | ||
889 | - int readLen = buf.writerIndex() - 0; | 852 | + int readLen = buf.writerIndex(); |
890 | testReportMsg = new byte[readLen]; | 853 | testReportMsg = new byte[readLen]; |
891 | buf.readBytes(testReportMsg, 0, readLen); | 854 | buf.readBytes(testReportMsg, 0, readLen); |
892 | 855 | ||
893 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 856 | + assertThat(testReportMsg, is(reportMsg)); |
894 | } | 857 | } |
895 | 858 | ||
896 | /** | 859 | /** |
897 | * This test case checks for SRP Object,LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, | 860 | * This test case checks for SRP Object,LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, |
898 | * StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | 861 | * StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
899 | * in PcRpt message. | 862 | * in PcRpt message. |
900 | - * @throws PcepParseException while parsing PCEP message | ||
901 | */ | 863 | */ |
902 | @Test | 864 | @Test |
903 | public void reportMessageTest21() throws PcepParseException { | 865 | public void reportMessageTest21() throws PcepParseException { |
904 | 866 | ||
905 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xac, | 867 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xac, |
906 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 868 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
907 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 869 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
908 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 870 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
... | @@ -913,7 +875,7 @@ public class PcepReportMsgTest { | ... | @@ -913,7 +875,7 @@ public class PcepReportMsgTest { |
913 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 875 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
914 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 876 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
915 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 877 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
916 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, | 878 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, |
917 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 879 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
918 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 880 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
919 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 881 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -922,7 +884,7 @@ public class PcepReportMsgTest { | ... | @@ -922,7 +884,7 @@ public class PcepReportMsgTest { |
922 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 884 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
923 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 885 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
924 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 886 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
925 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 887 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
926 | 888 | ||
927 | byte[] testReportMsg = {0}; | 889 | byte[] testReportMsg = {0}; |
928 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 890 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -933,28 +895,26 @@ public class PcepReportMsgTest { | ... | @@ -933,28 +895,26 @@ public class PcepReportMsgTest { |
933 | 895 | ||
934 | message = reader.readFrom(buffer); | 896 | message = reader.readFrom(buffer); |
935 | 897 | ||
936 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 898 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
937 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 899 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
938 | message.writeTo(buf); | 900 | message.writeTo(buf); |
939 | 901 | ||
940 | - int readLen = buf.writerIndex() - 0; | 902 | + int readLen = buf.writerIndex(); |
941 | testReportMsg = new byte[readLen]; | 903 | testReportMsg = new byte[readLen]; |
942 | buf.readBytes(testReportMsg, 0, readLen); | 904 | buf.readBytes(testReportMsg, 0, readLen); |
943 | 905 | ||
944 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 906 | + assertThat(testReportMsg, is(reportMsg)); |
945 | } | 907 | } |
946 | 908 | ||
947 | /** | 909 | /** |
948 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | 910 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
949 | * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | 911 | * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
950 | * in PcRpt message. | 912 | * in PcRpt message. |
951 | - * | ||
952 | - * @throws PcepParseException while parsing PCEP message | ||
953 | */ | 913 | */ |
954 | @Test | 914 | @Test |
955 | public void reportMessageTest22() throws PcepParseException { | 915 | public void reportMessageTest22() throws PcepParseException { |
956 | 916 | ||
957 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xA0, | 917 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xA0, |
958 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 918 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
959 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 919 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
960 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 920 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -964,7 +924,7 @@ public class PcepReportMsgTest { | ... | @@ -964,7 +924,7 @@ public class PcepReportMsgTest { |
964 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 924 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
965 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 925 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
966 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 926 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
967 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | 927 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
968 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 928 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
969 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 929 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
970 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 930 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -973,7 +933,7 @@ public class PcepReportMsgTest { | ... | @@ -973,7 +933,7 @@ public class PcepReportMsgTest { |
973 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 933 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
974 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 934 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
975 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 935 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
976 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 936 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
977 | 937 | ||
978 | byte[] testReportMsg = {0}; | 938 | byte[] testReportMsg = {0}; |
979 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 939 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -984,28 +944,26 @@ public class PcepReportMsgTest { | ... | @@ -984,28 +944,26 @@ public class PcepReportMsgTest { |
984 | 944 | ||
985 | message = reader.readFrom(buffer); | 945 | message = reader.readFrom(buffer); |
986 | 946 | ||
987 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 947 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
988 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 948 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
989 | message.writeTo(buf); | 949 | message.writeTo(buf); |
990 | 950 | ||
991 | - int readLen = buf.writerIndex() - 0; | 951 | + int readLen = buf.writerIndex(); |
992 | testReportMsg = new byte[readLen]; | 952 | testReportMsg = new byte[readLen]; |
993 | buf.readBytes(testReportMsg, 0, readLen); | 953 | buf.readBytes(testReportMsg, 0, readLen); |
994 | 954 | ||
995 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 955 | + assertThat(testReportMsg, is(reportMsg)); |
996 | } | 956 | } |
997 | 957 | ||
998 | /** | 958 | /** |
999 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | 959 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
1000 | * ERO Object,BandWidth Object,Metric-list,RRO Object | 960 | * ERO Object,BandWidth Object,Metric-list,RRO Object |
1001 | * in PcRpt message. | 961 | * in PcRpt message. |
1002 | - * | ||
1003 | - * @throws PcepParseException while parsing PCEP message | ||
1004 | */ | 962 | */ |
1005 | @Test | 963 | @Test |
1006 | public void reportMessageTest23() throws PcepParseException { | 964 | public void reportMessageTest23() throws PcepParseException { |
1007 | 965 | ||
1008 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c, | 966 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, |
1009 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 967 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1010 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 968 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
1011 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 969 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -1022,7 +980,7 @@ public class PcepReportMsgTest { | ... | @@ -1022,7 +980,7 @@ public class PcepReportMsgTest { |
1022 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 980 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1023 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 981 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1024 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 982 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1025 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 983 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1026 | 984 | ||
1027 | byte[] testReportMsg = {0}; | 985 | byte[] testReportMsg = {0}; |
1028 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 986 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1033,28 +991,26 @@ public class PcepReportMsgTest { | ... | @@ -1033,28 +991,26 @@ public class PcepReportMsgTest { |
1033 | 991 | ||
1034 | message = reader.readFrom(buffer); | 992 | message = reader.readFrom(buffer); |
1035 | 993 | ||
1036 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 994 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1037 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 995 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1038 | message.writeTo(buf); | 996 | message.writeTo(buf); |
1039 | 997 | ||
1040 | - int readLen = buf.writerIndex() - 0; | 998 | + int readLen = buf.writerIndex(); |
1041 | testReportMsg = new byte[readLen]; | 999 | testReportMsg = new byte[readLen]; |
1042 | buf.readBytes(testReportMsg, 0, readLen); | 1000 | buf.readBytes(testReportMsg, 0, readLen); |
1043 | 1001 | ||
1044 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1002 | + assertThat(testReportMsg, is(reportMsg)); |
1045 | } | 1003 | } |
1046 | 1004 | ||
1047 | /** | 1005 | /** |
1048 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | 1006 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
1049 | * ERO Object,Metric-list,RRO Object | 1007 | * ERO Object,Metric-list,RRO Object |
1050 | * in PcRpt message. | 1008 | * in PcRpt message. |
1051 | - * | ||
1052 | - * @throws PcepParseException while parsing PCEP message | ||
1053 | */ | 1009 | */ |
1054 | @Test | 1010 | @Test |
1055 | public void reportMessageTest24() throws PcepParseException { | 1011 | public void reportMessageTest24() throws PcepParseException { |
1056 | 1012 | ||
1057 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x84, | 1013 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x84, |
1058 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1014 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1059 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 1015 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
1060 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 1016 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -1070,7 +1026,7 @@ public class PcepReportMsgTest { | ... | @@ -1070,7 +1026,7 @@ public class PcepReportMsgTest { |
1070 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 1026 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1071 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1027 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1072 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1028 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1073 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 1029 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1074 | 1030 | ||
1075 | byte[] testReportMsg = {0}; | 1031 | byte[] testReportMsg = {0}; |
1076 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1032 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1081,28 +1037,26 @@ public class PcepReportMsgTest { | ... | @@ -1081,28 +1037,26 @@ public class PcepReportMsgTest { |
1081 | 1037 | ||
1082 | message = reader.readFrom(buffer); | 1038 | message = reader.readFrom(buffer); |
1083 | 1039 | ||
1084 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1040 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1085 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1041 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1086 | message.writeTo(buf); | 1042 | message.writeTo(buf); |
1087 | 1043 | ||
1088 | - int readLen = buf.writerIndex() - 0; | 1044 | + int readLen = buf.writerIndex(); |
1089 | testReportMsg = new byte[readLen]; | 1045 | testReportMsg = new byte[readLen]; |
1090 | buf.readBytes(testReportMsg, 0, readLen); | 1046 | buf.readBytes(testReportMsg, 0, readLen); |
1091 | 1047 | ||
1092 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1048 | + assertThat(testReportMsg, is(reportMsg)); |
1093 | } | 1049 | } |
1094 | 1050 | ||
1095 | /** | 1051 | /** |
1096 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | 1052 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
1097 | * ERO Object,LSPA Object,RRO Object | 1053 | * ERO Object,LSPA Object,RRO Object |
1098 | * in PcRpt message. | 1054 | * in PcRpt message. |
1099 | - * | ||
1100 | - * @throws PcepParseException while parsing PCEP message | ||
1101 | */ | 1055 | */ |
1102 | @Test | 1056 | @Test |
1103 | public void reportMessageTest25() throws PcepParseException { | 1057 | public void reportMessageTest25() throws PcepParseException { |
1104 | 1058 | ||
1105 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c, | 1059 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, |
1106 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1060 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1107 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 1061 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
1108 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 1062 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -1119,7 +1073,7 @@ public class PcepReportMsgTest { | ... | @@ -1119,7 +1073,7 @@ public class PcepReportMsgTest { |
1119 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 1073 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1120 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1074 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1121 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1075 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1122 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 1076 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1123 | 1077 | ||
1124 | byte[] testReportMsg = {0}; | 1078 | byte[] testReportMsg = {0}; |
1125 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1079 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1130,28 +1084,26 @@ public class PcepReportMsgTest { | ... | @@ -1130,28 +1084,26 @@ public class PcepReportMsgTest { |
1130 | 1084 | ||
1131 | message = reader.readFrom(buffer); | 1085 | message = reader.readFrom(buffer); |
1132 | 1086 | ||
1133 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1087 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1134 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1088 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1135 | message.writeTo(buf); | 1089 | message.writeTo(buf); |
1136 | 1090 | ||
1137 | - int readLen = buf.writerIndex() - 0; | 1091 | + int readLen = buf.writerIndex(); |
1138 | testReportMsg = new byte[readLen]; | 1092 | testReportMsg = new byte[readLen]; |
1139 | buf.readBytes(testReportMsg, 0, readLen); | 1093 | buf.readBytes(testReportMsg, 0, readLen); |
1140 | 1094 | ||
1141 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1095 | + assertThat(testReportMsg, is(reportMsg)); |
1142 | } | 1096 | } |
1143 | 1097 | ||
1144 | /** | 1098 | /** |
1145 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | 1099 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
1146 | * ERO Object,LSPA Object | 1100 | * ERO Object,LSPA Object |
1147 | * in PcRpt message. | 1101 | * in PcRpt message. |
1148 | - * | ||
1149 | - * @throws PcepParseException while parsing PCEP message | ||
1150 | */ | 1102 | */ |
1151 | @Test | 1103 | @Test |
1152 | public void reportMessageTest26() throws PcepParseException { | 1104 | public void reportMessageTest26() throws PcepParseException { |
1153 | 1105 | ||
1154 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x58, | 1106 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, |
1155 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1107 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1156 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 1108 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
1157 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 1109 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -1162,7 +1114,7 @@ public class PcepReportMsgTest { | ... | @@ -1162,7 +1114,7 @@ public class PcepReportMsgTest { |
1162 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1114 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1163 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1115 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1164 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object | 1116 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object |
1165 | - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 1117 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
1166 | 1118 | ||
1167 | byte[] testReportMsg = {0}; | 1119 | byte[] testReportMsg = {0}; |
1168 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1120 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1173,28 +1125,26 @@ public class PcepReportMsgTest { | ... | @@ -1173,28 +1125,26 @@ public class PcepReportMsgTest { |
1173 | 1125 | ||
1174 | message = reader.readFrom(buffer); | 1126 | message = reader.readFrom(buffer); |
1175 | 1127 | ||
1176 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1128 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1177 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1129 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1178 | message.writeTo(buf); | 1130 | message.writeTo(buf); |
1179 | 1131 | ||
1180 | - int readLen = buf.writerIndex() - 0; | 1132 | + int readLen = buf.writerIndex(); |
1181 | testReportMsg = new byte[readLen]; | 1133 | testReportMsg = new byte[readLen]; |
1182 | buf.readBytes(testReportMsg, 0, readLen); | 1134 | buf.readBytes(testReportMsg, 0, readLen); |
1183 | 1135 | ||
1184 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1136 | + assertThat(testReportMsg, is(reportMsg)); |
1185 | } | 1137 | } |
1186 | 1138 | ||
1187 | /** | 1139 | /** |
1188 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv) | 1140 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv) |
1189 | * ERO Object | 1141 | * ERO Object |
1190 | * in PcRpt message. | 1142 | * in PcRpt message. |
1191 | - * | ||
1192 | - * @throws PcepParseException while parsing PCEP message | ||
1193 | */ | 1143 | */ |
1194 | @Test | 1144 | @Test |
1195 | public void reportMessageTest27() throws PcepParseException { | 1145 | public void reportMessageTest27() throws PcepParseException { |
1196 | 1146 | ||
1197 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x44, | 1147 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, |
1198 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1148 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1199 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 1149 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
1200 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 1150 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -1203,7 +1153,7 @@ public class PcepReportMsgTest { | ... | @@ -1203,7 +1153,7 @@ public class PcepReportMsgTest { |
1203 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | 1153 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
1204 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1154 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1205 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1155 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1206 | - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 }; | 1156 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; |
1207 | 1157 | ||
1208 | byte[] testReportMsg = {0}; | 1158 | byte[] testReportMsg = {0}; |
1209 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1159 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1214,28 +1164,26 @@ public class PcepReportMsgTest { | ... | @@ -1214,28 +1164,26 @@ public class PcepReportMsgTest { |
1214 | 1164 | ||
1215 | message = reader.readFrom(buffer); | 1165 | message = reader.readFrom(buffer); |
1216 | 1166 | ||
1217 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1167 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1218 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1168 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1219 | message.writeTo(buf); | 1169 | message.writeTo(buf); |
1220 | 1170 | ||
1221 | - int readLen = buf.writerIndex() - 0; | 1171 | + int readLen = buf.writerIndex(); |
1222 | testReportMsg = new byte[readLen]; | 1172 | testReportMsg = new byte[readLen]; |
1223 | buf.readBytes(testReportMsg, 0, readLen); | 1173 | buf.readBytes(testReportMsg, 0, readLen); |
1224 | 1174 | ||
1225 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1175 | + assertThat(testReportMsg, is(reportMsg)); |
1226 | } | 1176 | } |
1227 | 1177 | ||
1228 | /** | 1178 | /** |
1229 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | 1179 | * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
1230 | * LSPA Object,BandWidth Object,Metric-list,ERO Object | 1180 | * LSPA Object,BandWidth Object,Metric-list,ERO Object |
1231 | * in PcRpt message. | 1181 | * in PcRpt message. |
1232 | - * | ||
1233 | - * @throws PcepParseException while parsing PCEP message | ||
1234 | */ | 1182 | */ |
1235 | @Test | 1183 | @Test |
1236 | public void reportMessageTest28() throws PcepParseException { | 1184 | public void reportMessageTest28() throws PcepParseException { |
1237 | 1185 | ||
1238 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6c, | 1186 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, |
1239 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1187 | 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1240 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | 1188 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
1241 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | 1189 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
... | @@ -1245,10 +1193,10 @@ public class PcepReportMsgTest { | ... | @@ -1245,10 +1193,10 @@ public class PcepReportMsgTest { |
1245 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1193 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1246 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1194 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1247 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1195 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1248 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | 1196 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
1249 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1197 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1250 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1198 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1251 | - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; | 1199 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; |
1252 | 1200 | ||
1253 | byte[] testReportMsg = {0}; | 1201 | byte[] testReportMsg = {0}; |
1254 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1202 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1259,27 +1207,25 @@ public class PcepReportMsgTest { | ... | @@ -1259,27 +1207,25 @@ public class PcepReportMsgTest { |
1259 | 1207 | ||
1260 | message = reader.readFrom(buffer); | 1208 | message = reader.readFrom(buffer); |
1261 | 1209 | ||
1262 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1210 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1263 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1211 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1264 | message.writeTo(buf); | 1212 | message.writeTo(buf); |
1265 | 1213 | ||
1266 | - int readLen = buf.writerIndex() - 0; | 1214 | + int readLen = buf.writerIndex(); |
1267 | testReportMsg = new byte[readLen]; | 1215 | testReportMsg = new byte[readLen]; |
1268 | buf.readBytes(testReportMsg, 0, readLen); | 1216 | buf.readBytes(testReportMsg, 0, readLen); |
1269 | 1217 | ||
1270 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1218 | + assertThat(testReportMsg, is(reportMsg)); |
1271 | } | 1219 | } |
1272 | 1220 | ||
1273 | /** | 1221 | /** |
1274 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object | 1222 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object |
1275 | * in PcRpt message. | 1223 | * in PcRpt message. |
1276 | - * | ||
1277 | - * @throws PcepParseException while parsing PCEP message | ||
1278 | */ | 1224 | */ |
1279 | @Test | 1225 | @Test |
1280 | public void reportMessageTest29() throws PcepParseException { | 1226 | public void reportMessageTest29() throws PcepParseException { |
1281 | 1227 | ||
1282 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74, | 1228 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, |
1283 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 1229 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
1284 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1230 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1285 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 1231 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
... | @@ -1292,7 +1238,7 @@ public class PcepReportMsgTest { | ... | @@ -1292,7 +1238,7 @@ public class PcepReportMsgTest { |
1292 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 1238 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1293 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1239 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1294 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1240 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1295 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 1241 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1296 | 1242 | ||
1297 | byte[] testReportMsg = {0}; | 1243 | byte[] testReportMsg = {0}; |
1298 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1244 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1303,28 +1249,26 @@ public class PcepReportMsgTest { | ... | @@ -1303,28 +1249,26 @@ public class PcepReportMsgTest { |
1303 | 1249 | ||
1304 | message = reader.readFrom(buffer); | 1250 | message = reader.readFrom(buffer); |
1305 | 1251 | ||
1306 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1252 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1307 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1253 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1308 | message.writeTo(buf); | 1254 | message.writeTo(buf); |
1309 | 1255 | ||
1310 | - int readLen = buf.writerIndex() - 0; | 1256 | + int readLen = buf.writerIndex(); |
1311 | testReportMsg = new byte[readLen]; | 1257 | testReportMsg = new byte[readLen]; |
1312 | buf.readBytes(testReportMsg, 0, readLen); | 1258 | buf.readBytes(testReportMsg, 0, readLen); |
1313 | 1259 | ||
1314 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1260 | + assertThat(testReportMsg, is(reportMsg)); |
1315 | } | 1261 | } |
1316 | 1262 | ||
1317 | /** | 1263 | /** |
1318 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object | 1264 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object |
1319 | * SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object | 1265 | * SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object |
1320 | * in PcRpt message. | 1266 | * in PcRpt message. |
1321 | - * | ||
1322 | - * @throws PcepParseException while parsing PCEP message | ||
1323 | */ | 1267 | */ |
1324 | @Test | 1268 | @Test |
1325 | public void reportMessageTest30() throws PcepParseException { | 1269 | public void reportMessageTest30() throws PcepParseException { |
1326 | 1270 | ||
1327 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xE4, | 1271 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xE4, |
1328 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 1272 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
1329 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1273 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1330 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 1274 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
... | @@ -1350,7 +1294,7 @@ public class PcepReportMsgTest { | ... | @@ -1350,7 +1294,7 @@ public class PcepReportMsgTest { |
1350 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 1294 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1351 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1295 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1352 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1296 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1353 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 1297 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1354 | 1298 | ||
1355 | byte[] testReportMsg = {0}; | 1299 | byte[] testReportMsg = {0}; |
1356 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1300 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1361,15 +1305,15 @@ public class PcepReportMsgTest { | ... | @@ -1361,15 +1305,15 @@ public class PcepReportMsgTest { |
1361 | 1305 | ||
1362 | message = reader.readFrom(buffer); | 1306 | message = reader.readFrom(buffer); |
1363 | 1307 | ||
1364 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1308 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1365 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1309 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1366 | message.writeTo(buf); | 1310 | message.writeTo(buf); |
1367 | 1311 | ||
1368 | - int readLen = buf.writerIndex() - 0; | 1312 | + int readLen = buf.writerIndex(); |
1369 | testReportMsg = new byte[readLen]; | 1313 | testReportMsg = new byte[readLen]; |
1370 | buf.readBytes(testReportMsg, 0, readLen); | 1314 | buf.readBytes(testReportMsg, 0, readLen); |
1371 | 1315 | ||
1372 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1316 | + assertThat(testReportMsg, is(reportMsg)); |
1373 | } | 1317 | } |
1374 | 1318 | ||
1375 | /** | 1319 | /** |
... | @@ -1377,20 +1321,18 @@ public class PcepReportMsgTest { | ... | @@ -1377,20 +1321,18 @@ public class PcepReportMsgTest { |
1377 | * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) | 1321 | * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) |
1378 | * ERO Object,Metric-list,RRO Object | 1322 | * ERO Object,Metric-list,RRO Object |
1379 | * in PcRpt message. | 1323 | * in PcRpt message. |
1380 | - * | ||
1381 | - * @throws PcepParseException while parsing PCEP message | ||
1382 | */ | 1324 | */ |
1383 | @Test | 1325 | @Test |
1384 | public void reportMessageTest31() throws PcepParseException { | 1326 | public void reportMessageTest31() throws PcepParseException { |
1385 | 1327 | ||
1386 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, 0x00, | 1328 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, 0x00, |
1387 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 1329 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
1388 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1330 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1389 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 1331 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
1390 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1332 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1391 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1333 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1392 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1334 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1393 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 1335 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
1394 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1336 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1395 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1337 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1396 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 1338 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -1412,7 +1354,7 @@ public class PcepReportMsgTest { | ... | @@ -1412,7 +1354,7 @@ public class PcepReportMsgTest { |
1412 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 1354 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1413 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1355 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1414 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1356 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1415 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 1357 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1416 | 1358 | ||
1417 | byte[] testReportMsg = {0}; | 1359 | byte[] testReportMsg = {0}; |
1418 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1360 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1423,15 +1365,15 @@ public class PcepReportMsgTest { | ... | @@ -1423,15 +1365,15 @@ public class PcepReportMsgTest { |
1423 | 1365 | ||
1424 | message = reader.readFrom(buffer); | 1366 | message = reader.readFrom(buffer); |
1425 | 1367 | ||
1426 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1368 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1427 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1369 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1428 | message.writeTo(buf); | 1370 | message.writeTo(buf); |
1429 | 1371 | ||
1430 | - int readLen = buf.writerIndex() - 0; | 1372 | + int readLen = buf.writerIndex(); |
1431 | testReportMsg = new byte[readLen]; | 1373 | testReportMsg = new byte[readLen]; |
1432 | buf.readBytes(testReportMsg, 0, readLen); | 1374 | buf.readBytes(testReportMsg, 0, readLen); |
1433 | 1375 | ||
1434 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1376 | + assertThat(testReportMsg, is(reportMsg)); |
1435 | } | 1377 | } |
1436 | 1378 | ||
1437 | /** | 1379 | /** |
... | @@ -1439,20 +1381,18 @@ public class PcepReportMsgTest { | ... | @@ -1439,20 +1381,18 @@ public class PcepReportMsgTest { |
1439 | * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) | 1381 | * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) |
1440 | * ERO Object,LSPA Object,Metric-list,RRO Object | 1382 | * ERO Object,LSPA Object,Metric-list,RRO Object |
1441 | * in PcRpt message. | 1383 | * in PcRpt message. |
1442 | - * | ||
1443 | - * @throws PcepParseException while parsing PCEP message | ||
1444 | */ | 1384 | */ |
1445 | @Test | 1385 | @Test |
1446 | public void reportMessageTest32() throws PcepParseException { | 1386 | public void reportMessageTest32() throws PcepParseException { |
1447 | 1387 | ||
1448 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, (byte) 0x14, | 1388 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x14, |
1449 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 1389 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
1450 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1390 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1451 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 1391 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
1452 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1392 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1453 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1393 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1454 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1394 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1455 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 1395 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
1456 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1396 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1457 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1397 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1458 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 1398 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -1468,7 +1408,7 @@ public class PcepReportMsgTest { | ... | @@ -1468,7 +1408,7 @@ public class PcepReportMsgTest { |
1468 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1408 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1469 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1409 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1470 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1410 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1471 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 1411 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
1472 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1412 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1473 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 1413 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
1474 | 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | 1414 | 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
... | @@ -1476,7 +1416,7 @@ public class PcepReportMsgTest { | ... | @@ -1476,7 +1416,7 @@ public class PcepReportMsgTest { |
1476 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 1416 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1477 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1417 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1478 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1418 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1479 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 1419 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1480 | 1420 | ||
1481 | byte[] testReportMsg = {0}; | 1421 | byte[] testReportMsg = {0}; |
1482 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1422 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1487,15 +1427,15 @@ public class PcepReportMsgTest { | ... | @@ -1487,15 +1427,15 @@ public class PcepReportMsgTest { |
1487 | 1427 | ||
1488 | message = reader.readFrom(buffer); | 1428 | message = reader.readFrom(buffer); |
1489 | 1429 | ||
1490 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1430 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1491 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1431 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1492 | message.writeTo(buf); | 1432 | message.writeTo(buf); |
1493 | 1433 | ||
1494 | - int readLen = buf.writerIndex() - 0; | 1434 | + int readLen = buf.writerIndex(); |
1495 | testReportMsg = new byte[readLen]; | 1435 | testReportMsg = new byte[readLen]; |
1496 | buf.readBytes(testReportMsg, 0, readLen); | 1436 | buf.readBytes(testReportMsg, 0, readLen); |
1497 | 1437 | ||
1498 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1438 | + assertThat(testReportMsg, is(reportMsg)); |
1499 | } | 1439 | } |
1500 | 1440 | ||
1501 | /** | 1441 | /** |
... | @@ -1503,20 +1443,18 @@ public class PcepReportMsgTest { | ... | @@ -1503,20 +1443,18 @@ public class PcepReportMsgTest { |
1503 | * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) | 1443 | * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) |
1504 | * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | 1444 | * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
1505 | * in PcRpt message. | 1445 | * in PcRpt message. |
1506 | - * | ||
1507 | - * @throws PcepParseException while parsing PCEP message | ||
1508 | */ | 1446 | */ |
1509 | @Test | 1447 | @Test |
1510 | public void reportMessageTest33() throws PcepParseException { | 1448 | public void reportMessageTest33() throws PcepParseException { |
1511 | 1449 | ||
1512 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, (byte) 0x1c, | 1450 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x1c, |
1513 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 1451 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
1514 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1452 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1515 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 1453 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
1516 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1454 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1517 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1455 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1518 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1456 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1519 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 1457 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
1520 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1458 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1521 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1459 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1522 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 1460 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -1532,7 +1470,7 @@ public class PcepReportMsgTest { | ... | @@ -1532,7 +1470,7 @@ public class PcepReportMsgTest { |
1532 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1470 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1533 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1471 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1534 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1472 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1535 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | 1473 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
1536 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1474 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1537 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1475 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1538 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 1476 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -1541,7 +1479,7 @@ public class PcepReportMsgTest { | ... | @@ -1541,7 +1479,7 @@ public class PcepReportMsgTest { |
1541 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | 1479 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
1542 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1480 | 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1543 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | 1481 | 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
1544 | - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | 1482 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
1545 | 1483 | ||
1546 | byte[] testReportMsg = {0}; | 1484 | byte[] testReportMsg = {0}; |
1547 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1485 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1552,15 +1490,15 @@ public class PcepReportMsgTest { | ... | @@ -1552,15 +1490,15 @@ public class PcepReportMsgTest { |
1552 | 1490 | ||
1553 | message = reader.readFrom(buffer); | 1491 | message = reader.readFrom(buffer); |
1554 | 1492 | ||
1555 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1493 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1556 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1494 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1557 | message.writeTo(buf); | 1495 | message.writeTo(buf); |
1558 | 1496 | ||
1559 | - int readLen = buf.writerIndex() - 0; | 1497 | + int readLen = buf.writerIndex(); |
1560 | testReportMsg = new byte[readLen]; | 1498 | testReportMsg = new byte[readLen]; |
1561 | buf.readBytes(testReportMsg, 0, readLen); | 1499 | buf.readBytes(testReportMsg, 0, readLen); |
1562 | 1500 | ||
1563 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1501 | + assertThat(testReportMsg, is(reportMsg)); |
1564 | } | 1502 | } |
1565 | 1503 | ||
1566 | /** | 1504 | /** |
... | @@ -1568,20 +1506,18 @@ public class PcepReportMsgTest { | ... | @@ -1568,20 +1506,18 @@ public class PcepReportMsgTest { |
1568 | * BandWidth Object,Metric-list,SRP Object,LSP Object(symbolic path tlv) | 1506 | * BandWidth Object,Metric-list,SRP Object,LSP Object(symbolic path tlv) |
1569 | * ERO Object,LSPA Object,BandWidth Object,Metric-list | 1507 | * ERO Object,LSPA Object,BandWidth Object,Metric-list |
1570 | * in PcRpt message. | 1508 | * in PcRpt message. |
1571 | - * | ||
1572 | - * @throws PcepParseException while parsing PCEP message | ||
1573 | */ | 1509 | */ |
1574 | @Test | 1510 | @Test |
1575 | public void reportMessageTest34() throws PcepParseException { | 1511 | public void reportMessageTest34() throws PcepParseException { |
1576 | 1512 | ||
1577 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xB4, | 1513 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xB4, |
1578 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 1514 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
1579 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1515 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1580 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 1516 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
1581 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1517 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1582 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1518 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1583 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1519 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1584 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 1520 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
1585 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1521 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1586 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1522 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1587 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | 1523 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
... | @@ -1591,10 +1527,10 @@ public class PcepReportMsgTest { | ... | @@ -1591,10 +1527,10 @@ public class PcepReportMsgTest { |
1591 | 0x07, 0x10, 0x00, 0x14, //ERO Object | 1527 | 0x07, 0x10, 0x00, 0x14, //ERO Object |
1592 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | 1528 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
1593 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | 1529 | 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
1594 | - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | 1530 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
1595 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1531 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1596 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1532 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1597 | - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric Object | 1533 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object |
1598 | 1534 | ||
1599 | byte[] testReportMsg = {0}; | 1535 | byte[] testReportMsg = {0}; |
1600 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1536 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1605,28 +1541,26 @@ public class PcepReportMsgTest { | ... | @@ -1605,28 +1541,26 @@ public class PcepReportMsgTest { |
1605 | 1541 | ||
1606 | message = reader.readFrom(buffer); | 1542 | message = reader.readFrom(buffer); |
1607 | 1543 | ||
1608 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1544 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1609 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1545 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1610 | message.writeTo(buf); | 1546 | message.writeTo(buf); |
1611 | 1547 | ||
1612 | - int readLen = buf.writerIndex() - 0; | 1548 | + int readLen = buf.writerIndex(); |
1613 | testReportMsg = new byte[readLen]; | 1549 | testReportMsg = new byte[readLen]; |
1614 | buf.readBytes(testReportMsg, 0, readLen); | 1550 | buf.readBytes(testReportMsg, 0, readLen); |
1615 | 1551 | ||
1616 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1552 | + assertThat(testReportMsg, is(reportMsg)); |
1617 | } | 1553 | } |
1618 | 1554 | ||
1619 | /** | 1555 | /** |
1620 | * This test case checks for SRP Object,LSP Object)Symbolic path tlv),ERO Object,SRP Object | 1556 | * This test case checks for SRP Object,LSP Object)Symbolic path tlv),ERO Object,SRP Object |
1621 | * LSP Object(symbolic path tlv) ERO Object,LSPA Object, BandWidth Object,Metric-list | 1557 | * LSP Object(symbolic path tlv) ERO Object,LSPA Object, BandWidth Object,Metric-list |
1622 | * in PcRpt message. | 1558 | * in PcRpt message. |
1623 | - * | ||
1624 | - * @throws PcepParseException while parsing PCEP message | ||
1625 | */ | 1559 | */ |
1626 | @Test | 1560 | @Test |
1627 | public void reportMessageTest35() throws PcepParseException { | 1561 | public void reportMessageTest35() throws PcepParseException { |
1628 | 1562 | ||
1629 | - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8C, | 1563 | + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8C, |
1630 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | 1564 | 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
1631 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | 1565 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
1632 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | 1566 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
... | @@ -1643,7 +1577,7 @@ public class PcepReportMsgTest { | ... | @@ -1643,7 +1577,7 @@ public class PcepReportMsgTest { |
1643 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1577 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1644 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 1578 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
1645 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | 1579 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
1646 | - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric Object | 1580 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object |
1647 | 1581 | ||
1648 | byte[] testReportMsg = {0}; | 1582 | byte[] testReportMsg = {0}; |
1649 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 1583 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
... | @@ -1654,14 +1588,14 @@ public class PcepReportMsgTest { | ... | @@ -1654,14 +1588,14 @@ public class PcepReportMsgTest { |
1654 | 1588 | ||
1655 | message = reader.readFrom(buffer); | 1589 | message = reader.readFrom(buffer); |
1656 | 1590 | ||
1657 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 1591 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
1658 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1592 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1659 | message.writeTo(buf); | 1593 | message.writeTo(buf); |
1660 | 1594 | ||
1661 | - int readLen = buf.writerIndex() - 0; | 1595 | + int readLen = buf.writerIndex(); |
1662 | testReportMsg = new byte[readLen]; | 1596 | testReportMsg = new byte[readLen]; |
1663 | buf.readBytes(testReportMsg, 0, readLen); | 1597 | buf.readBytes(testReportMsg, 0, readLen); |
1664 | 1598 | ||
1665 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 1599 | + assertThat(testReportMsg, is(reportMsg)); |
1666 | } | 1600 | } |
1667 | } | 1601 | } | ... | ... |
... | @@ -15,9 +15,11 @@ | ... | @@ -15,9 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.pcepio; | 16 | package org.onosproject.pcepio; |
17 | 17 | ||
18 | +import static org.hamcrest.MatcherAssert.assertThat; | ||
19 | +import static org.hamcrest.Matchers.instanceOf; | ||
20 | +import static org.hamcrest.core.Is.is; | ||
18 | import org.jboss.netty.buffer.ChannelBuffer; | 21 | import org.jboss.netty.buffer.ChannelBuffer; |
19 | import org.jboss.netty.buffer.ChannelBuffers; | 22 | import org.jboss.netty.buffer.ChannelBuffers; |
20 | -import org.junit.Assert; | ||
21 | import org.junit.Test; | 23 | import org.junit.Test; |
22 | import org.onosproject.pcepio.exceptions.PcepParseException; | 24 | import org.onosproject.pcepio.exceptions.PcepParseException; |
23 | import org.onosproject.pcepio.protocol.PcepFactories; | 25 | import org.onosproject.pcepio.protocol.PcepFactories; |
... | @@ -31,8 +33,6 @@ public class PcepReportMsgTest2 { | ... | @@ -31,8 +33,6 @@ public class PcepReportMsgTest2 { |
31 | * This test case checks forSRP Object,LSP Object(symbolic path tlv),ERO Object | 33 | * This test case checks forSRP Object,LSP Object(symbolic path tlv),ERO Object |
32 | * SRP Object,LSP Object(symbolic path tlv,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | 34 | * SRP Object,LSP Object(symbolic path tlv,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
33 | * in PcRpt message. | 35 | * in PcRpt message. |
34 | - * | ||
35 | - * @throws PcepParseException while parsing PCEP message | ||
36 | */ | 36 | */ |
37 | @Test | 37 | @Test |
38 | public void reportMessageTest39() throws PcepParseException { | 38 | public void reportMessageTest39() throws PcepParseException { |
... | @@ -65,23 +65,21 @@ public class PcepReportMsgTest2 { | ... | @@ -65,23 +65,21 @@ public class PcepReportMsgTest2 { |
65 | PcepMessage message = null; | 65 | PcepMessage message = null; |
66 | 66 | ||
67 | message = reader.readFrom(buffer); | 67 | message = reader.readFrom(buffer); |
68 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 68 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
69 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 69 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
70 | message.writeTo(buf); | 70 | message.writeTo(buf); |
71 | 71 | ||
72 | - int readLen = buf.writerIndex() - 0; | 72 | + int readLen = buf.writerIndex(); |
73 | testReportMsg = new byte[readLen]; | 73 | testReportMsg = new byte[readLen]; |
74 | buf.readBytes(testReportMsg, 0, readLen); | 74 | buf.readBytes(testReportMsg, 0, readLen); |
75 | 75 | ||
76 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 76 | + assertThat(testReportMsg, is(reportMsg)); |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object | 80 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object |
81 | * SRP Object,LSP Object(symbolic path tlv),ERO Object | 81 | * SRP Object,LSP Object(symbolic path tlv),ERO Object |
82 | * in PcRpt message. | 82 | * in PcRpt message. |
83 | - * | ||
84 | - * @throws PcepParseException while parsing PCEP message | ||
85 | */ | 83 | */ |
86 | @Test | 84 | @Test |
87 | public void reportMessageTest40() throws PcepParseException { | 85 | public void reportMessageTest40() throws PcepParseException { |
... | @@ -108,23 +106,21 @@ public class PcepReportMsgTest2 { | ... | @@ -108,23 +106,21 @@ public class PcepReportMsgTest2 { |
108 | PcepMessage message = null; | 106 | PcepMessage message = null; |
109 | 107 | ||
110 | message = reader.readFrom(buffer); | 108 | message = reader.readFrom(buffer); |
111 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 109 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
112 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 110 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
113 | message.writeTo(buf); | 111 | message.writeTo(buf); |
114 | 112 | ||
115 | - int readLen = buf.writerIndex() - 0; | 113 | + int readLen = buf.writerIndex(); |
116 | testReportMsg = new byte[readLen]; | 114 | testReportMsg = new byte[readLen]; |
117 | buf.readBytes(testReportMsg, 0, readLen); | 115 | buf.readBytes(testReportMsg, 0, readLen); |
118 | 116 | ||
119 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 117 | + assertThat(testReportMsg, is(reportMsg)); |
120 | } | 118 | } |
121 | 119 | ||
122 | /** | 120 | /** |
123 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object | 121 | * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object |
124 | * SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object | 122 | * SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object |
125 | * in PcRpt message. | 123 | * in PcRpt message. |
126 | - * | ||
127 | - * @throws PcepParseException while parsing PCEP message | ||
128 | */ | 124 | */ |
129 | @Test | 125 | @Test |
130 | public void reportMessageTest41() throws PcepParseException { | 126 | public void reportMessageTest41() throws PcepParseException { |
... | @@ -155,15 +151,15 @@ public class PcepReportMsgTest2 { | ... | @@ -155,15 +151,15 @@ public class PcepReportMsgTest2 { |
155 | PcepMessage message = null; | 151 | PcepMessage message = null; |
156 | 152 | ||
157 | message = reader.readFrom(buffer); | 153 | message = reader.readFrom(buffer); |
158 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 154 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
159 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 155 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
160 | message.writeTo(buf); | 156 | message.writeTo(buf); |
161 | 157 | ||
162 | - int readLen = buf.writerIndex() - 0; | 158 | + int readLen = buf.writerIndex(); |
163 | testReportMsg = new byte[readLen]; | 159 | testReportMsg = new byte[readLen]; |
164 | buf.readBytes(testReportMsg, 0, readLen); | 160 | buf.readBytes(testReportMsg, 0, readLen); |
165 | 161 | ||
166 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 162 | + assertThat(testReportMsg, is(reportMsg)); |
167 | } | 163 | } |
168 | 164 | ||
169 | /** | 165 | /** |
... | @@ -171,8 +167,6 @@ public class PcepReportMsgTest2 { | ... | @@ -171,8 +167,6 @@ public class PcepReportMsgTest2 { |
171 | * Metric-list SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object,Metric-list, | 167 | * Metric-list SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object,Metric-list, |
172 | * RRO Object | 168 | * RRO Object |
173 | * in PcRpt message. | 169 | * in PcRpt message. |
174 | - * | ||
175 | - * @throws PcepParseException while parsing PCEP message | ||
176 | */ | 170 | */ |
177 | @Test | 171 | @Test |
178 | public void reportMessageTest42() throws PcepParseException { | 172 | public void reportMessageTest42() throws PcepParseException { |
... | @@ -214,14 +208,14 @@ public class PcepReportMsgTest2 { | ... | @@ -214,14 +208,14 @@ public class PcepReportMsgTest2 { |
214 | 208 | ||
215 | message = reader.readFrom(buffer); | 209 | message = reader.readFrom(buffer); |
216 | 210 | ||
217 | - Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | 211 | + assertThat(message, instanceOf(PcepReportMsg.class)); |
218 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 212 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
219 | message.writeTo(buf); | 213 | message.writeTo(buf); |
220 | 214 | ||
221 | - int readLen = buf.writerIndex() - 0; | 215 | + int readLen = buf.writerIndex(); |
222 | testReportMsg = new byte[readLen]; | 216 | testReportMsg = new byte[readLen]; |
223 | buf.readBytes(testReportMsg, 0, readLen); | 217 | buf.readBytes(testReportMsg, 0, readLen); |
224 | 218 | ||
225 | - Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | 219 | + assertThat(testReportMsg, is(reportMsg)); |
226 | } | 220 | } |
227 | } | 221 | } | ... | ... |
-
Please register or login to post a comment