Phaneendra Manda
Committed by Ray Milkey

UT for PcepErr msg updated with assertThat

Change-Id: Ib7a3a58a22e2e998123c6772f6b518eda40c7045
...@@ -18,7 +18,6 @@ package org.onosproject.pcepio; ...@@ -18,7 +18,6 @@ package org.onosproject.pcepio;
18 18
19 import org.jboss.netty.buffer.ChannelBuffer; 19 import org.jboss.netty.buffer.ChannelBuffer;
20 import org.jboss.netty.buffer.ChannelBuffers; 20 import org.jboss.netty.buffer.ChannelBuffers;
21 -import org.junit.Assert;
22 import org.junit.Test; 21 import org.junit.Test;
23 import org.onosproject.pcepio.exceptions.PcepParseException; 22 import org.onosproject.pcepio.exceptions.PcepParseException;
24 import org.onosproject.pcepio.protocol.PcepErrorMsg; 23 import org.onosproject.pcepio.protocol.PcepErrorMsg;
...@@ -26,6 +25,10 @@ import org.onosproject.pcepio.protocol.PcepFactories; ...@@ -26,6 +25,10 @@ import org.onosproject.pcepio.protocol.PcepFactories;
26 import org.onosproject.pcepio.protocol.PcepMessage; 25 import org.onosproject.pcepio.protocol.PcepMessage;
27 import org.onosproject.pcepio.protocol.PcepMessageReader; 26 import org.onosproject.pcepio.protocol.PcepMessageReader;
28 27
28 +import static org.hamcrest.MatcherAssert.assertThat;
29 +import static org.hamcrest.core.Is.is;
30 +import static org.hamcrest.core.IsSame.sameInstance;
31 +
29 /** 32 /**
30 * Test cases for PCEP ERROR Message. 33 * Test cases for PCEP ERROR Message.
31 */ 34 */
...@@ -36,13 +39,11 @@ public class PcepErrorMsgTest { ...@@ -36,13 +39,11 @@ public class PcepErrorMsgTest {
36 * PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, 39 * PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV,
37 * PCECC-CAPABILITY-TLV, TED Capability TLV) 40 * PCECC-CAPABILITY-TLV, TED Capability TLV)
38 * in PcepErrorMsg message. 41 * in PcepErrorMsg message.
39 - *
40 - * @throws PcepParseException while parsing PCEP message
41 */ 42 */
42 @Test 43 @Test
43 public void errorMessageTest1() throws PcepParseException { 44 public void errorMessageTest1() throws PcepParseException {
44 45
45 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x34, // common header 46 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x34, // common header
46 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 47 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
47 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x28, // OPEN object header 48 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x28, // OPEN object header
48 0x20, 0x05, 0x1E, 0x01, // OPEN object 49 0x20, 0x05, 0x1E, 0x01, // OPEN object
...@@ -50,7 +51,7 @@ public class PcepErrorMsgTest { ...@@ -50,7 +51,7 @@ public class PcepErrorMsgTest {
50 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV 51 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV
51 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV 52 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV
52 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV 53 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV
53 - 0x00, 0x00, 0x00, 0x00 }; 54 + 0x00, 0x00, 0x00, 0x00};
54 55
55 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 56 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
56 buffer.writeBytes(errorMsg); 57 buffer.writeBytes(errorMsg);
...@@ -60,16 +61,16 @@ public class PcepErrorMsgTest { ...@@ -60,16 +61,16 @@ public class PcepErrorMsgTest {
60 61
61 message = reader.readFrom(buffer); 62 message = reader.readFrom(buffer);
62 63
63 - byte[] testErrorMsg = {0 }; 64 + byte[] testErrorMsg = {0};
64 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 65 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
65 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 66 +
67 + assertThat(message, sameInstance((PcepErrorMsg) message));
66 message.writeTo(buf); 68 message.writeTo(buf);
67 - int iReadLen = buf.writerIndex() - 0; 69 + int iReadLen = buf.writerIndex();
68 testErrorMsg = new byte[iReadLen]; 70 testErrorMsg = new byte[iReadLen];
69 buf.readBytes(testErrorMsg, 0, iReadLen); 71 buf.readBytes(testErrorMsg, 0, iReadLen);
70 72
71 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 73 + assertThat(testErrorMsg, is(errorMsg));
72 -
73 } 74 }
74 75
75 /** 76 /**
...@@ -77,13 +78,11 @@ public class PcepErrorMsgTest { ...@@ -77,13 +78,11 @@ public class PcepErrorMsgTest {
77 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, 78 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV,
78 * PCECC-CAPABILITY-TLV, TED Capability TLV) 79 * PCECC-CAPABILITY-TLV, TED Capability TLV)
79 * in PcepErrorMsg message. 80 * in PcepErrorMsg message.
80 - *
81 - * @throws PcepParseException while parsing PCEP message
82 */ 81 */
83 @Test 82 @Test
84 public void errorMessageTest2() throws PcepParseException { 83 public void errorMessageTest2() throws PcepParseException {
85 84
86 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x3C, // common header 85 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header
87 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 86 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
88 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 87 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
89 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x28, // OPEN object header 88 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x28, // OPEN object header
...@@ -92,7 +91,7 @@ public class PcepErrorMsgTest { ...@@ -92,7 +91,7 @@ public class PcepErrorMsgTest {
92 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV 91 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV 92 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV
94 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV 93 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV
95 - 0x00, 0x00, 0x00, 0x00 }; 94 + 0x00, 0x00, 0x00, 0x00};
96 95
97 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 96 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
98 buffer.writeBytes(errorMsg); 97 buffer.writeBytes(errorMsg);
...@@ -102,16 +101,15 @@ public class PcepErrorMsgTest { ...@@ -102,16 +101,15 @@ public class PcepErrorMsgTest {
102 101
103 message = reader.readFrom(buffer); 102 message = reader.readFrom(buffer);
104 103
105 - byte[] testErrorMsg = {0 }; 104 + byte[] testErrorMsg = {0};
106 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 105 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
107 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 106 + assertThat(message, sameInstance((PcepErrorMsg) message));
108 message.writeTo(buf); 107 message.writeTo(buf);
109 - int iReadLen = buf.writerIndex() - 0; 108 + int iReadLen = buf.writerIndex();
110 testErrorMsg = new byte[iReadLen]; 109 testErrorMsg = new byte[iReadLen];
111 buf.readBytes(testErrorMsg, 0, iReadLen); 110 buf.readBytes(testErrorMsg, 0, iReadLen);
112 111
113 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 112 + assertThat(testErrorMsg, is(errorMsg));
114 -
115 } 113 }
116 114
117 /** 115 /**
...@@ -119,13 +117,11 @@ public class PcepErrorMsgTest { ...@@ -119,13 +117,11 @@ public class PcepErrorMsgTest {
119 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, 117 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV,
120 * PCECC-CAPABILITY-TLV) 118 * PCECC-CAPABILITY-TLV)
121 * in PcepErrorMsg message. 119 * in PcepErrorMsg message.
122 - *
123 - * @throws PcepParseException while parsing PCEP message
124 */ 120 */
125 @Test 121 @Test
126 public void errorMessageTest3() throws PcepParseException { 122 public void errorMessageTest3() throws PcepParseException {
127 123
128 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x34, // common header 124 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x34, // common header
129 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 125 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
130 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 126 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
131 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x20, // OPEN object header 127 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x20, // OPEN object header
...@@ -133,7 +129,7 @@ public class PcepErrorMsgTest { ...@@ -133,7 +129,7 @@ public class PcepErrorMsgTest {
133 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY 129 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY
134 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV 130 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV 131 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV
136 - 0x00, 0x00, 0x00, 0x03 }; 132 + 0x00, 0x00, 0x00, 0x03};
137 133
138 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 134 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
139 buffer.writeBytes(errorMsg); 135 buffer.writeBytes(errorMsg);
...@@ -143,36 +139,33 @@ public class PcepErrorMsgTest { ...@@ -143,36 +139,33 @@ public class PcepErrorMsgTest {
143 139
144 message = reader.readFrom(buffer); 140 message = reader.readFrom(buffer);
145 141
146 - byte[] testErrorMsg = {0 }; 142 + byte[] testErrorMsg = {0};
147 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 143 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
148 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 144 + assertThat(message, sameInstance((PcepErrorMsg) message));
149 message.writeTo(buf); 145 message.writeTo(buf);
150 - int iReadLen = buf.writerIndex() - 0; 146 + int iReadLen = buf.writerIndex();
151 testErrorMsg = new byte[iReadLen]; 147 testErrorMsg = new byte[iReadLen];
152 buf.readBytes(testErrorMsg, 0, iReadLen); 148 buf.readBytes(testErrorMsg, 0, iReadLen);
153 149
154 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 150 + assertThat(testErrorMsg, is(errorMsg));
155 -
156 } 151 }
157 152
158 /** 153 /**
159 * This test case checks for 154 * This test case checks for
160 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV) 155 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV)
161 * in PcepErrorMsg message. 156 * in PcepErrorMsg message.
162 - *
163 - * @throws PcepParseException while parsing PCEP message
164 */ 157 */
165 @Test 158 @Test
166 public void errorMessageTest4() throws PcepParseException { 159 public void errorMessageTest4() throws PcepParseException {
167 160
168 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x2c, // common header 161 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2c, // common header
169 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 162 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
170 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 163 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
171 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x18, // OPEN object header 164 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x18, // OPEN object header
172 0x20, 0x05, 0x1E, 0x01, // OPEN object 165 0x20, 0x05, 0x1E, 0x01, // OPEN object
173 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY 166 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY
174 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV 167 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV
175 - 0x00, 0x00, 0x00, 0x00 }; 168 + 0x00, 0x00, 0x00, 0x00};
176 169
177 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 170 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
178 buffer.writeBytes(errorMsg); 171 buffer.writeBytes(errorMsg);
...@@ -182,35 +175,32 @@ public class PcepErrorMsgTest { ...@@ -182,35 +175,32 @@ public class PcepErrorMsgTest {
182 175
183 message = reader.readFrom(buffer); 176 message = reader.readFrom(buffer);
184 177
185 - byte[] testErrorMsg = {0 }; 178 + byte[] testErrorMsg = {0};
186 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 179 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
187 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 180 + assertThat(message, sameInstance((PcepErrorMsg) message));
188 message.writeTo(buf); 181 message.writeTo(buf);
189 - int iReadLen = buf.writerIndex() - 0; 182 + int iReadLen = buf.writerIndex();
190 testErrorMsg = new byte[iReadLen]; 183 testErrorMsg = new byte[iReadLen];
191 buf.readBytes(testErrorMsg, 0, iReadLen); 184 buf.readBytes(testErrorMsg, 0, iReadLen);
192 185
193 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 186 + assertThat(testErrorMsg, is(errorMsg));
194 -
195 } 187 }
196 188
197 /** 189 /**
198 * This test case checks for 190 * This test case checks for
199 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY) 191 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY)
200 * in PcepErrorMsg message. 192 * in PcepErrorMsg message.
201 - *
202 - * @throws PcepParseException while parsing PCEP message
203 */ 193 */
204 @Test 194 @Test
205 public void errorMessageTest5() throws PcepParseException { 195 public void errorMessageTest5() throws PcepParseException {
206 196
207 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x24, // common header 197 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header
208 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 198 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
209 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 199 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
210 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x10, // OPEN object header 200 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x10, // OPEN object header
211 0x20, 0x05, 0x1E, 0x01, // OPEN object 201 0x20, 0x05, 0x1E, 0x01, // OPEN object
212 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY 202 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY
213 - 0x00, 0x00, 0x00, 0x05 }; 203 + 0x00, 0x00, 0x00, 0x05};
214 204
215 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 205 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
216 buffer.writeBytes(errorMsg); 206 buffer.writeBytes(errorMsg);
...@@ -220,29 +210,26 @@ public class PcepErrorMsgTest { ...@@ -220,29 +210,26 @@ public class PcepErrorMsgTest {
220 210
221 message = reader.readFrom(buffer); 211 message = reader.readFrom(buffer);
222 212
223 - byte[] testErrorMsg = {0 }; 213 + byte[] testErrorMsg = {0};
224 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 214 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
225 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 215 + assertThat(message, sameInstance((PcepErrorMsg) message));
226 message.writeTo(buf); 216 message.writeTo(buf);
227 - int iReadLen = buf.writerIndex() - 0; 217 + int iReadLen = buf.writerIndex();
228 testErrorMsg = new byte[iReadLen]; 218 testErrorMsg = new byte[iReadLen];
229 buf.readBytes(testErrorMsg, 0, iReadLen); 219 buf.readBytes(testErrorMsg, 0, iReadLen);
230 220
231 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 221 + assertThat(testErrorMsg, is(errorMsg));
232 -
233 } 222 }
234 223
235 /** 224 /**
236 * This test case checks for 225 * This test case checks for
237 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object 226 * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object
238 * in PcepErrorMsg message. 227 * in PcepErrorMsg message.
239 - *
240 - * @throws PcepParseException while parsing PCEP message
241 */ 228 */
242 @Test 229 @Test
243 public void errorMessageTest6() throws PcepParseException { 230 public void errorMessageTest6() throws PcepParseException {
244 231
245 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x1C, // common header 232 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x1C, // common header
246 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 233 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
247 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 234 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
248 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x08, // OPEN object header 235 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x08, // OPEN object header
...@@ -257,29 +244,26 @@ public class PcepErrorMsgTest { ...@@ -257,29 +244,26 @@ public class PcepErrorMsgTest {
257 244
258 message = reader.readFrom(buffer); 245 message = reader.readFrom(buffer);
259 246
260 - byte[] testErrorMsg = {0 }; 247 + byte[] testErrorMsg = {0};
261 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 248 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
262 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 249 + assertThat(message, sameInstance((PcepErrorMsg) message));
263 message.writeTo(buf); 250 message.writeTo(buf);
264 - int iReadLen = buf.writerIndex() - 0; 251 + int iReadLen = buf.writerIndex();
265 testErrorMsg = new byte[iReadLen]; 252 testErrorMsg = new byte[iReadLen];
266 buf.readBytes(testErrorMsg, 0, iReadLen); 253 buf.readBytes(testErrorMsg, 0, iReadLen);
267 254
268 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 255 + assertThat(testErrorMsg, is(errorMsg));
269 -
270 } 256 }
271 257
272 /** 258 /**
273 * This test case checks for 259 * This test case checks for
274 * PCEP-ERROR Object, OPEN Object 260 * PCEP-ERROR Object, OPEN Object
275 * in PcepErrorMsg message. 261 * in PcepErrorMsg message.
276 - *
277 - * @throws PcepParseException while parsing PCEP message
278 */ 262 */
279 @Test 263 @Test
280 public void errorMessageTest7() throws PcepParseException { 264 public void errorMessageTest7() throws PcepParseException {
281 265
282 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x14, // common header 266 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header
283 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 267 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
284 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x08, // OPEN object header 268 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x08, // OPEN object header
285 0x20, 0x05, 0x1E, 0x01 // OPEN object 269 0x20, 0x05, 0x1E, 0x01 // OPEN object
...@@ -293,33 +277,30 @@ public class PcepErrorMsgTest { ...@@ -293,33 +277,30 @@ public class PcepErrorMsgTest {
293 277
294 message = reader.readFrom(buffer); 278 message = reader.readFrom(buffer);
295 279
296 - byte[] testErrorMsg = {0 }; 280 + byte[] testErrorMsg = {0};
297 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 281 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
298 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 282 + assertThat(message, sameInstance((PcepErrorMsg) message));
299 message.writeTo(buf); 283 message.writeTo(buf);
300 - int iReadLen = buf.writerIndex() - 0; 284 + int iReadLen = buf.writerIndex();
301 testErrorMsg = new byte[iReadLen]; 285 testErrorMsg = new byte[iReadLen];
302 buf.readBytes(testErrorMsg, 0, iReadLen); 286 buf.readBytes(testErrorMsg, 0, iReadLen);
303 287
304 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 288 + assertThat(testErrorMsg, is(errorMsg));
305 -
306 } 289 }
307 290
308 /** 291 /**
309 * This test case checks for 292 * This test case checks for
310 * PCEP-ERROR Object, RP Object, PCEP-ERROR Object 293 * PCEP-ERROR Object, RP Object, PCEP-ERROR Object
311 * in PcepErrorMsg message. 294 * in PcepErrorMsg message.
312 - *
313 - * @throws PcepParseException while parsing PCEP message
314 */ 295 */
315 @Test 296 @Test
316 public void errorMessageTest8() throws PcepParseException { 297 public void errorMessageTest8() throws PcepParseException {
317 298
318 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x20, // common header 299 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x20, // common header
319 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 300 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
320 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 301 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
322 - 0x00, 0x00, 0x01, 0x03 }; 303 + 0x00, 0x00, 0x01, 0x03};
323 304
324 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 305 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
325 buffer.writeBytes(errorMsg); 306 buffer.writeBytes(errorMsg);
...@@ -329,32 +310,29 @@ public class PcepErrorMsgTest { ...@@ -329,32 +310,29 @@ public class PcepErrorMsgTest {
329 310
330 message = reader.readFrom(buffer); 311 message = reader.readFrom(buffer);
331 312
332 - byte[] testErrorMsg = {0 }; 313 + byte[] testErrorMsg = {0};
333 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 314 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
334 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 315 + assertThat(message, sameInstance((PcepErrorMsg) message));
335 message.writeTo(buf); 316 message.writeTo(buf);
336 - int iReadLen = buf.writerIndex() - 0; 317 + int iReadLen = buf.writerIndex();
337 testErrorMsg = new byte[iReadLen]; 318 testErrorMsg = new byte[iReadLen];
338 buf.readBytes(testErrorMsg, 0, iReadLen); 319 buf.readBytes(testErrorMsg, 0, iReadLen);
339 320
340 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 321 + assertThat(testErrorMsg, is(errorMsg));
341 -
342 } 322 }
343 323
344 /** 324 /**
345 * This test case checks for 325 * This test case checks for
346 * PCEP-ERROR Object, PCEP-ERROR Object 326 * PCEP-ERROR Object, PCEP-ERROR Object
347 * in PcepErrorMsg message. 327 * in PcepErrorMsg message.
348 - *
349 - * @throws PcepParseException while parsing PCEP message
350 */ 328 */
351 @Test 329 @Test
352 public void errorMessageTest9() throws PcepParseException { 330 public void errorMessageTest9() throws PcepParseException {
353 331
354 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x14, // common header 332 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header
355 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 333 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
356 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 334 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
357 - 0x00, 0x00, 0x01, 0x01 }; 335 + 0x00, 0x00, 0x01, 0x01};
358 336
359 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 337 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
360 buffer.writeBytes(errorMsg); 338 buffer.writeBytes(errorMsg);
...@@ -364,32 +342,29 @@ public class PcepErrorMsgTest { ...@@ -364,32 +342,29 @@ public class PcepErrorMsgTest {
364 342
365 message = reader.readFrom(buffer); 343 message = reader.readFrom(buffer);
366 344
367 - byte[] testErrorMsg = {0 }; 345 + byte[] testErrorMsg = {0};
368 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 346 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
369 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 347 + assertThat(message, sameInstance((PcepErrorMsg) message));
370 message.writeTo(buf); 348 message.writeTo(buf);
371 - int iReadLen = buf.writerIndex() - 0; 349 + int iReadLen = buf.writerIndex();
372 testErrorMsg = new byte[iReadLen]; 350 testErrorMsg = new byte[iReadLen];
373 buf.readBytes(testErrorMsg, 0, iReadLen); 351 buf.readBytes(testErrorMsg, 0, iReadLen);
374 352
375 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 353 + assertThat(testErrorMsg, is(errorMsg));
376 -
377 } 354 }
378 355
379 /** 356 /**
380 * This test case checks for 357 * This test case checks for
381 * PCEP-ERROR Object, PCEP-ERROR Object 358 * PCEP-ERROR Object, PCEP-ERROR Object
382 * in PcepErrorMsg message. 359 * in PcepErrorMsg message.
383 - *
384 - * @throws PcepParseException while parsing PCEP message
385 */ 360 */
386 @Test 361 @Test
387 public void errorMessageTest10() throws PcepParseException { 362 public void errorMessageTest10() throws PcepParseException {
388 363
389 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x14, // common header 364 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header
390 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 365 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
391 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 366 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
392 - 0x00, 0x00, 0x01, 0x01 }; 367 + 0x00, 0x00, 0x01, 0x01};
393 368
394 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 369 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
395 buffer.writeBytes(errorMsg); 370 buffer.writeBytes(errorMsg);
...@@ -399,33 +374,30 @@ public class PcepErrorMsgTest { ...@@ -399,33 +374,30 @@ public class PcepErrorMsgTest {
399 374
400 message = reader.readFrom(buffer); 375 message = reader.readFrom(buffer);
401 376
402 - byte[] testErrorMsg = {0 }; 377 + byte[] testErrorMsg = {0};
403 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 378 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
404 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 379 + assertThat(message, sameInstance((PcepErrorMsg) message));
405 message.writeTo(buf); 380 message.writeTo(buf);
406 - int iReadLen = buf.writerIndex() - 0; 381 + int iReadLen = buf.writerIndex();
407 testErrorMsg = new byte[iReadLen]; 382 testErrorMsg = new byte[iReadLen];
408 buf.readBytes(testErrorMsg, 0, iReadLen); 383 buf.readBytes(testErrorMsg, 0, iReadLen);
409 384
410 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 385 + assertThat(testErrorMsg, is(errorMsg));
411 -
412 } 386 }
413 387
414 /** 388 /**
415 * This test case checks for 389 * This test case checks for
416 * TE Object, PCEP-ERROR Object 390 * TE Object, PCEP-ERROR Object
417 * in PcepErrorMsg message. 391 * in PcepErrorMsg message.
418 - *
419 - * @throws PcepParseException while parsing PCEP message
420 */ 392 */
421 @Test 393 @Test
422 public void errorMessageTest11() throws PcepParseException { 394 public void errorMessageTest11() throws PcepParseException {
423 395
424 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x18, // common header 396 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x18, // common header
425 0x65, 0x13, 0x00, 0x0C, // TE Object Header 397 0x65, 0x13, 0x00, 0x0C, // TE Object Header
426 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID 398 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
427 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 399 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
428 - 0x00, 0x00, 0x01, 0x01 }; 400 + 0x00, 0x00, 0x01, 0x01};
429 401
430 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 402 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
431 buffer.writeBytes(errorMsg); 403 buffer.writeBytes(errorMsg);
...@@ -435,33 +407,30 @@ public class PcepErrorMsgTest { ...@@ -435,33 +407,30 @@ public class PcepErrorMsgTest {
435 407
436 message = reader.readFrom(buffer); 408 message = reader.readFrom(buffer);
437 409
438 - byte[] testErrorMsg = {0 }; 410 + byte[] testErrorMsg = {0};
439 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 411 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
440 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 412 + assertThat(message, sameInstance((PcepErrorMsg) message));
441 message.writeTo(buf); 413 message.writeTo(buf);
442 - int iReadLen = buf.writerIndex() - 0; 414 + int iReadLen = buf.writerIndex();
443 testErrorMsg = new byte[iReadLen]; 415 testErrorMsg = new byte[iReadLen];
444 buf.readBytes(testErrorMsg, 0, iReadLen); 416 buf.readBytes(testErrorMsg, 0, iReadLen);
445 417
446 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 418 + assertThat(testErrorMsg, is(errorMsg));
447 -
448 } 419 }
449 420
450 /** 421 /**
451 * This test case checks for 422 * This test case checks for
452 * RP Object, PCEP-ERROR Object 423 * RP Object, PCEP-ERROR Object
453 * in PcepErrorMsg message. 424 * in PcepErrorMsg message.
454 - *
455 - * @throws PcepParseException while parsing PCEP message
456 */ 425 */
457 @Test 426 @Test
458 public void errorMessageTest12() throws PcepParseException { 427 public void errorMessageTest12() throws PcepParseException {
459 428
460 //RP Object, PCEP-ERROR Object 429 //RP Object, PCEP-ERROR Object
461 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x18, // common header 430 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x18, // common header
462 0x02, 0x10, 0x00, 0x0C, // RP Object Header 431 0x02, 0x10, 0x00, 0x0C, // RP Object Header
463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
464 - 0x00, 0x00, 0x01, 0x01 }; 433 + 0x00, 0x00, 0x01, 0x01};
465 434
466 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 435 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
467 buffer.writeBytes(errorMsg); 436 buffer.writeBytes(errorMsg);
...@@ -471,33 +440,30 @@ public class PcepErrorMsgTest { ...@@ -471,33 +440,30 @@ public class PcepErrorMsgTest {
471 440
472 message = reader.readFrom(buffer); 441 message = reader.readFrom(buffer);
473 442
474 - byte[] testErrorMsg = {0 }; 443 + byte[] testErrorMsg = {0};
475 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 444 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
476 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 445 + assertThat(message, sameInstance((PcepErrorMsg) message));
477 message.writeTo(buf); 446 message.writeTo(buf);
478 - int iReadLen = buf.writerIndex() - 0; 447 + int iReadLen = buf.writerIndex();
479 testErrorMsg = new byte[iReadLen]; 448 testErrorMsg = new byte[iReadLen];
480 buf.readBytes(testErrorMsg, 0, iReadLen); 449 buf.readBytes(testErrorMsg, 0, iReadLen);
481 450
482 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 451 + assertThat(testErrorMsg, is(errorMsg));
483 -
484 } 452 }
485 453
486 /** 454 /**
487 * This test case checks for 455 * This test case checks for
488 * RP Object, RP Object, PCEP-ERROR Object 456 * RP Object, RP Object, PCEP-ERROR Object
489 * in PcepErrorMsg message. 457 * in PcepErrorMsg message.
490 - *
491 - * @throws PcepParseException while parsing PCEP message
492 */ 458 */
493 @Test 459 @Test
494 public void errorMessageTest13() throws PcepParseException { 460 public void errorMessageTest13() throws PcepParseException {
495 461
496 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x24, // common header 462 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header
497 0x02, 0x10, 0x00, 0x0C, // RP Object Header 463 0x02, 0x10, 0x00, 0x0C, // RP Object Header
498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
500 - 0x00, 0x00, 0x01, 0x01 }; 466 + 0x00, 0x00, 0x01, 0x01};
501 467
502 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 468 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
503 buffer.writeBytes(errorMsg); 469 buffer.writeBytes(errorMsg);
...@@ -507,35 +473,32 @@ public class PcepErrorMsgTest { ...@@ -507,35 +473,32 @@ public class PcepErrorMsgTest {
507 473
508 message = reader.readFrom(buffer); 474 message = reader.readFrom(buffer);
509 475
510 - byte[] testErrorMsg = {0 }; 476 + byte[] testErrorMsg = {0};
511 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 477 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
512 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 478 + assertThat(message, sameInstance((PcepErrorMsg) message));
513 message.writeTo(buf); 479 message.writeTo(buf);
514 - int iReadLen = buf.writerIndex() - 0; 480 + int iReadLen = buf.writerIndex();
515 testErrorMsg = new byte[iReadLen]; 481 testErrorMsg = new byte[iReadLen];
516 buf.readBytes(testErrorMsg, 0, iReadLen); 482 buf.readBytes(testErrorMsg, 0, iReadLen);
517 483
518 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 484 + assertThat(testErrorMsg, is(errorMsg));
519 -
520 } 485 }
521 486
522 /** 487 /**
523 * This test case checks for 488 * This test case checks for
524 * TE Object, TE Object, PCEP-ERROR Object 489 * TE Object, TE Object, PCEP-ERROR Object
525 * in PcepErrorMsg message. 490 * in PcepErrorMsg message.
526 - *
527 - * @throws PcepParseException while parsing PCEP message
528 */ 491 */
529 @Test 492 @Test
530 public void errorMessageTest14() throws PcepParseException { 493 public void errorMessageTest14() throws PcepParseException {
531 494
532 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x24, // common header 495 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header
533 0x65, 0x10, 0x00, 0x0C, // TE Object Header 496 0x65, 0x10, 0x00, 0x0C, // TE Object Header
534 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID 497 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
535 0x65, 0x10, 0x00, 0x0C, // TE Object Header 498 0x65, 0x10, 0x00, 0x0C, // TE Object Header
536 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID 499 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID
537 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 500 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
538 - 0x00, 0x00, 0x01, 0x01 }; 501 + 0x00, 0x00, 0x01, 0x01};
539 502
540 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 503 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
541 buffer.writeBytes(errorMsg); 504 buffer.writeBytes(errorMsg);
...@@ -545,34 +508,31 @@ public class PcepErrorMsgTest { ...@@ -545,34 +508,31 @@ public class PcepErrorMsgTest {
545 508
546 message = reader.readFrom(buffer); 509 message = reader.readFrom(buffer);
547 510
548 - byte[] testErrorMsg = {0 }; 511 + byte[] testErrorMsg = {0};
549 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 512 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
550 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 513 + assertThat(message, sameInstance((PcepErrorMsg) message));
551 message.writeTo(buf); 514 message.writeTo(buf);
552 - int iReadLen = buf.writerIndex() - 0; 515 + int iReadLen = buf.writerIndex();
553 testErrorMsg = new byte[iReadLen]; 516 testErrorMsg = new byte[iReadLen];
554 buf.readBytes(testErrorMsg, 0, iReadLen); 517 buf.readBytes(testErrorMsg, 0, iReadLen);
555 518
556 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 519 + assertThat(testErrorMsg, is(errorMsg));
557 -
558 } 520 }
559 521
560 /** 522 /**
561 * This test case checks for 523 * This test case checks for
562 * PCEP-ERROR Object, TE Object, PCEP-ERROR Object 524 * PCEP-ERROR Object, TE Object, PCEP-ERROR Object
563 * in PcepErrorMsg message. 525 * in PcepErrorMsg message.
564 - *
565 - * @throws PcepParseException while parsing PCEP message
566 */ 526 */
567 @Test 527 @Test
568 public void errorMessageTest15() throws PcepParseException { 528 public void errorMessageTest15() throws PcepParseException {
569 529
570 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x20, // common header 530 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x20, // common header
571 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 531 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
572 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header 532 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header
573 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID 533 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
574 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 534 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
575 - 0x00, 0x00, 0x01, 0x03 }; 535 + 0x00, 0x00, 0x01, 0x03};
576 536
577 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 537 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
578 buffer.writeBytes(errorMsg); 538 buffer.writeBytes(errorMsg);
...@@ -582,34 +542,31 @@ public class PcepErrorMsgTest { ...@@ -582,34 +542,31 @@ public class PcepErrorMsgTest {
582 542
583 message = reader.readFrom(buffer); 543 message = reader.readFrom(buffer);
584 544
585 - byte[] testErrorMsg = {0 }; 545 + byte[] testErrorMsg = {0};
586 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 546 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
587 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 547 + assertThat(message, sameInstance((PcepErrorMsg) message));
588 message.writeTo(buf); 548 message.writeTo(buf);
589 - int iReadLen = buf.writerIndex() - 0; 549 + int iReadLen = buf.writerIndex();
590 testErrorMsg = new byte[iReadLen]; 550 testErrorMsg = new byte[iReadLen];
591 buf.readBytes(testErrorMsg, 0, iReadLen); 551 buf.readBytes(testErrorMsg, 0, iReadLen);
592 552
593 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 553 + assertThat(testErrorMsg, is(errorMsg));
594 -
595 } 554 }
596 555
597 /** 556 /**
598 * This test case checks for 557 * This test case checks for
599 * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object 558 * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object
600 * in PcepErrorMsg message. 559 * in PcepErrorMsg message.
601 - *
602 - * @throws PcepParseException while parsing PCEP message
603 */ 560 */
604 @Test 561 @Test
605 public void errorMessageTest16() throws PcepParseException { 562 public void errorMessageTest16() throws PcepParseException {
606 563
607 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x2C, // common header 564 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2C, // common header
608 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 565 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
609 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 566 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 567 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 568 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
612 - 0x00, 0x00, 0x01, 0x03 }; 569 + 0x00, 0x00, 0x01, 0x03};
613 570
614 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 571 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
615 buffer.writeBytes(errorMsg); 572 buffer.writeBytes(errorMsg);
...@@ -619,36 +576,33 @@ public class PcepErrorMsgTest { ...@@ -619,36 +576,33 @@ public class PcepErrorMsgTest {
619 576
620 message = reader.readFrom(buffer); 577 message = reader.readFrom(buffer);
621 578
622 - byte[] testErrorMsg = {0 }; 579 + byte[] testErrorMsg = {0};
623 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 580 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
624 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 581 + assertThat(message, sameInstance((PcepErrorMsg) message));
625 message.writeTo(buf); 582 message.writeTo(buf);
626 - int iReadLen = buf.writerIndex() - 0; 583 + int iReadLen = buf.writerIndex();
627 testErrorMsg = new byte[iReadLen]; 584 testErrorMsg = new byte[iReadLen];
628 buf.readBytes(testErrorMsg, 0, iReadLen); 585 buf.readBytes(testErrorMsg, 0, iReadLen);
629 586
630 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 587 + assertThat(testErrorMsg, is(errorMsg));
631 -
632 } 588 }
633 589
634 /** 590 /**
635 * This test case checks for 591 * This test case checks for
636 * PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object 592 * PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object
637 * in PcepErrorMsg message. 593 * in PcepErrorMsg message.
638 - *
639 - * @throws PcepParseException while parsing PCEP message
640 */ 594 */
641 @Test 595 @Test
642 public void errorMessageTest17() throws PcepParseException { 596 public void errorMessageTest17() throws PcepParseException {
643 597
644 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x2C, // common header 598 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2C, // common header
645 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 599 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
646 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header 600 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header
647 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID 601 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
648 0x65, 0x10, 0x00, 0x0C, // TE Object Header 602 0x65, 0x10, 0x00, 0x0C, // TE Object Header
649 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID 603 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID
650 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 604 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
651 - 0x00, 0x00, 0x01, 0x03 }; 605 + 0x00, 0x00, 0x01, 0x03};
652 606
653 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 607 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
654 buffer.writeBytes(errorMsg); 608 buffer.writeBytes(errorMsg);
...@@ -658,36 +612,33 @@ public class PcepErrorMsgTest { ...@@ -658,36 +612,33 @@ public class PcepErrorMsgTest {
658 612
659 message = reader.readFrom(buffer); 613 message = reader.readFrom(buffer);
660 614
661 - byte[] testErrorMsg = {0 }; 615 + byte[] testErrorMsg = {0};
662 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 616 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
663 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 617 + assertThat(message, sameInstance((PcepErrorMsg) message));
664 message.writeTo(buf); 618 message.writeTo(buf);
665 - int iReadLen = buf.writerIndex() - 0; 619 + int iReadLen = buf.writerIndex();
666 testErrorMsg = new byte[iReadLen]; 620 testErrorMsg = new byte[iReadLen];
667 buf.readBytes(testErrorMsg, 0, iReadLen); 621 buf.readBytes(testErrorMsg, 0, iReadLen);
668 622
669 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 623 + assertThat(testErrorMsg, is(errorMsg));
670 -
671 } 624 }
672 625
673 /** 626 /**
674 * This test case checks for 627 * This test case checks for
675 * PCEP-ERROR Object, PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object 628 * PCEP-ERROR Object, PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object
676 * in PcepErrorMsg message. 629 * in PcepErrorMsg message.
677 - *
678 - * @throws PcepParseException while parsing PCEP message
679 */ 630 */
680 @Test 631 @Test
681 public void errorMessageTest18() throws PcepParseException { 632 public void errorMessageTest18() throws PcepParseException {
682 633
683 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x3C, // common header 634 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header
684 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 635 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
685 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 636 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
686 0x00, 0x00, 0x01, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 637 0x00, 0x00, 0x01, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
687 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
688 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
689 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 640 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
690 - 0x00, 0x00, 0x01, 0x06 }; 641 + 0x00, 0x00, 0x01, 0x06};
691 642
692 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 643 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
693 buffer.writeBytes(errorMsg); 644 buffer.writeBytes(errorMsg);
...@@ -697,29 +648,26 @@ public class PcepErrorMsgTest { ...@@ -697,29 +648,26 @@ public class PcepErrorMsgTest {
697 648
698 message = reader.readFrom(buffer); 649 message = reader.readFrom(buffer);
699 650
700 - byte[] testErrorMsg = {0 }; 651 + byte[] testErrorMsg = {0};
701 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 652 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
702 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 653 + assertThat(message, sameInstance((PcepErrorMsg) message));
703 message.writeTo(buf); 654 message.writeTo(buf);
704 - int iReadLen = buf.writerIndex() - 0; 655 + int iReadLen = buf.writerIndex();
705 testErrorMsg = new byte[iReadLen]; 656 testErrorMsg = new byte[iReadLen];
706 buf.readBytes(testErrorMsg, 0, iReadLen); 657 buf.readBytes(testErrorMsg, 0, iReadLen);
707 658
708 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 659 + assertThat(testErrorMsg, is(errorMsg));
709 -
710 } 660 }
711 661
712 /** 662 /**
713 * This test case checks for 663 * This test case checks for
714 * PCEP-ERROR Object, PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object, PCEP-ERROR Object 664 * PCEP-ERROR Object, PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object, PCEP-ERROR Object
715 * in PcepErrorMsg message. 665 * in PcepErrorMsg message.
716 - *
717 - * @throws PcepParseException while parsing PCEP message
718 */ 666 */
719 @Test 667 @Test
720 public void errorMessageTest19() throws PcepParseException { 668 public void errorMessageTest19() throws PcepParseException {
721 669
722 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x3C, // common header 670 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header
723 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 671 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
724 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 672 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
725 0x00, 0x00, 0x01, 0x03, 0x65, 0x10, 0x00, 0x0C, // TE Object Header 673 0x00, 0x00, 0x01, 0x03, 0x65, 0x10, 0x00, 0x0C, // TE Object Header
...@@ -728,7 +676,7 @@ public class PcepErrorMsgTest { ...@@ -728,7 +676,7 @@ public class PcepErrorMsgTest {
728 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID 676 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID
729 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 677 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
730 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 678 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
731 - 0x00, 0x00, 0x01, 0x06 }; 679 + 0x00, 0x00, 0x01, 0x06};
732 680
733 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 681 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
734 buffer.writeBytes(errorMsg); 682 buffer.writeBytes(errorMsg);
...@@ -738,16 +686,15 @@ public class PcepErrorMsgTest { ...@@ -738,16 +686,15 @@ public class PcepErrorMsgTest {
738 686
739 message = reader.readFrom(buffer); 687 message = reader.readFrom(buffer);
740 688
741 - byte[] testErrorMsg = {0 }; 689 + byte[] testErrorMsg = {0};
742 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 690 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
743 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 691 + assertThat(message, sameInstance((PcepErrorMsg) message));
744 message.writeTo(buf); 692 message.writeTo(buf);
745 - int iReadLen = buf.writerIndex() - 0; 693 + int iReadLen = buf.writerIndex();
746 testErrorMsg = new byte[iReadLen]; 694 testErrorMsg = new byte[iReadLen];
747 buf.readBytes(testErrorMsg, 0, iReadLen); 695 buf.readBytes(testErrorMsg, 0, iReadLen);
748 696
749 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 697 + assertThat(testErrorMsg, is(errorMsg));
750 -
751 } 698 }
752 699
753 /** 700 /**
...@@ -755,13 +702,11 @@ public class PcepErrorMsgTest { ...@@ -755,13 +702,11 @@ public class PcepErrorMsgTest {
755 * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object, 702 * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object,
756 * TE Object, PCEP-ERROR Object 703 * TE Object, PCEP-ERROR Object
757 * in PcepErrorMsg message. 704 * in PcepErrorMsg message.
758 - *
759 - * @throws PcepParseException while parsing PCEP message
760 */ 705 */
761 @Test 706 @Test
762 public void errorMessageTest20() throws PcepParseException { 707 public void errorMessageTest20() throws PcepParseException {
763 708
764 - byte[] errorMsg = new byte[] {0x20, 0x06, 0x00, 0x48, // common header 709 + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x48, // common header
765 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header 710 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
766 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 711 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
767 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header 712 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header
...@@ -770,7 +715,7 @@ public class PcepErrorMsgTest { ...@@ -770,7 +715,7 @@ public class PcepErrorMsgTest {
770 0x00, 0x00, 0x01, 0x06, 0x65, 0x10, 0x00, 0x0C, // TE Object Header 715 0x00, 0x00, 0x01, 0x06, 0x65, 0x10, 0x00, 0x0C, // TE Object Header
771 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID 716 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
772 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header 717 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
773 - 0x00, 0x00, 0x01, 0x06 }; 718 + 0x00, 0x00, 0x01, 0x06};
774 719
775 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 720 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
776 buffer.writeBytes(errorMsg); 721 buffer.writeBytes(errorMsg);
...@@ -780,16 +725,15 @@ public class PcepErrorMsgTest { ...@@ -780,16 +725,15 @@ public class PcepErrorMsgTest {
780 725
781 message = reader.readFrom(buffer); 726 message = reader.readFrom(buffer);
782 727
783 - byte[] testErrorMsg = {0 }; 728 + byte[] testErrorMsg = {0};
784 ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); 729 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
785 - Assert.assertTrue("PcepMessage is not instance of PcepErrorMsg", message instanceof PcepErrorMsg); 730 + assertThat(message, sameInstance((PcepErrorMsg) message));
786 731
787 message.writeTo(buf); 732 message.writeTo(buf);
788 - int iReadLen = buf.writerIndex() - 0; 733 + int iReadLen = buf.writerIndex();
789 testErrorMsg = new byte[iReadLen]; 734 testErrorMsg = new byte[iReadLen];
790 buf.readBytes(testErrorMsg, 0, iReadLen); 735 buf.readBytes(testErrorMsg, 0, iReadLen);
791 736
792 - Assert.assertArrayEquals("PcepErrorMsg messages are not equal", errorMsg, testErrorMsg); 737 + assertThat(testErrorMsg, is(errorMsg));
793 -
794 } 738 }
795 } 739 }
......