UT for Pcep Update Message (Updated with AssertThat)
Change-Id: I2d4d0e4463a08532e739e03e4e8c6a54595f1ae4
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java
index 52e97b1..8e9afee 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java
@@ -15,9 +15,12 @@
*/
package org.onosproject.pcepio;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsSame.sameInstance;
+
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Assert;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepFactories;
@@ -28,8 +31,6 @@
public class PcepUpdateMsgTest {
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), ERO in PcUpd message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void pcepUpdateMsgTest1() throws PcepParseException {
@@ -50,7 +51,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -59,14 +60,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP(SymbolicPathNameTlv), LSP (StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO, LSPA, Metric-list in PcUpd message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void pcepUpdateMsgTest2() throws PcepParseException {
@@ -96,7 +95,7 @@
PcepMessage message = null;
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -105,14 +104,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* ERO objects in PcUpd message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void pcepUpdateMsgTest3() throws PcepParseException {
@@ -135,7 +132,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -144,14 +141,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv), ERO objects in PcUpd message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void pcepUpdateMsgTest4() throws PcepParseException {
@@ -175,7 +170,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -184,14 +179,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv), ERO objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest5() throws PcepParseException {
@@ -215,7 +208,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -224,14 +217,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest6() throws PcepParseException {
@@ -256,7 +247,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -265,15 +256,13 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest7() throws PcepParseException {
@@ -298,7 +287,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -306,14 +295,12 @@
int readLen = buf.writerIndex() - 0;
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO (IPv4SubObject) objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest8() throws PcepParseException {
@@ -339,7 +326,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -348,14 +335,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject) objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest9() throws PcepParseException {
@@ -382,7 +367,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -391,14 +376,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject), LSPA objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest10() throws PcepParseException {
@@ -427,7 +410,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -436,14 +419,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest11() throws PcepParseException {
@@ -473,7 +454,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -482,14 +463,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest12() throws PcepParseException {
@@ -518,7 +497,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -527,14 +506,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest13() throws PcepParseException {
@@ -563,7 +540,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -572,14 +549,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* ERO (IPv4SubObject, IPv4SubObject),LSPA, metric Object objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest14() throws PcepParseException {
@@ -607,7 +582,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -616,14 +591,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest15() throws PcepParseException {
@@ -651,7 +624,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -660,14 +633,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest16() throws PcepParseException {
@@ -694,7 +665,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -703,14 +674,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject),LSPA objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest17() throws PcepParseException {
@@ -736,7 +705,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -745,14 +714,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject),Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest18() throws PcepParseException {
@@ -777,7 +744,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -786,14 +753,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject),Metric-list objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest19() throws PcepParseException {
@@ -819,7 +784,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -828,14 +793,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv),ERO (IPv4SubObject, IPv4SubObject),LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest20() throws PcepParseException {
@@ -866,7 +829,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -875,14 +838,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject), Bandwidth objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest21() throws PcepParseException {
@@ -907,7 +868,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -916,14 +877,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest22() throws PcepParseException {
@@ -950,7 +909,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -959,14 +918,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest23() throws PcepParseException {
@@ -994,7 +951,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1003,14 +960,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest24() throws PcepParseException {
@@ -1039,7 +994,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1048,14 +1003,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest25() throws PcepParseException {
@@ -1084,7 +1037,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1093,15 +1046,13 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth,
* Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest26() throws PcepParseException {
@@ -1130,7 +1081,7 @@
PcepMessage message = null;
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1139,15 +1090,13 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth,
* Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest27() throws PcepParseException {
@@ -1177,7 +1126,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1186,15 +1135,13 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),
* LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest28() throws PcepParseException {
@@ -1225,7 +1172,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1234,14 +1181,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest29() throws PcepParseException {
@@ -1269,7 +1214,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1278,14 +1223,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP,
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest30() throws PcepParseException {
@@ -1310,7 +1253,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1319,14 +1262,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (StatefulLspErrorCodeTlv),
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest31() throws PcepParseException {
@@ -1352,7 +1293,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1361,14 +1302,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP,
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest32() throws PcepParseException {
@@ -1393,7 +1332,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1402,14 +1341,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv),
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest33() throws PcepParseException {
@@ -1435,7 +1372,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1444,14 +1381,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv),
* ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
- *
- * @throws PcepParseException when message parsing fails
*/
@Test
public void pcepUpdateMsgTest34() throws PcepParseException {
@@ -1478,7 +1413,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcUpd", (message instanceof PcepUpdateMsg));
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1487,6 +1422,6 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcUpd messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
}
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest2.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest2.java
index cd507f5..d42ca3c 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest2.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest2.java
@@ -15,9 +15,12 @@
*/
package org.onosproject.pcepio;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsSame.sameInstance;
+
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Assert;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepFactories;
@@ -33,8 +36,6 @@
/**
* This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object,
* Metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest1() throws PcepParseException {
@@ -65,7 +66,7 @@
PcepMessage message = null;
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
@@ -75,14 +76,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,
* LSPA, Bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest2() throws PcepParseException {
@@ -109,7 +108,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -118,14 +117,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object, ERO object, LSPA, bandwidth object
* Metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest3() throws PcepParseException {
@@ -149,7 +146,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -158,14 +155,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,bandwidth object
* Metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest4() throws PcepParseException {
@@ -190,7 +185,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -199,14 +194,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,bandwidth object
* Metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest5() throws PcepParseException {
@@ -232,7 +225,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -241,14 +234,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, LSPA, bandwidth object
* Metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest6() throws PcepParseException {
@@ -273,7 +264,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -282,14 +273,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,
* bandwidth object Metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest7() throws PcepParseException {
@@ -315,7 +304,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -324,14 +313,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest8() throws PcepParseException {
@@ -357,7 +344,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -366,14 +353,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest9() throws PcepParseException {
@@ -398,7 +383,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -407,14 +392,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest10() throws PcepParseException {
@@ -438,7 +421,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -447,14 +430,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest11() throws PcepParseException {
@@ -477,7 +458,7 @@
PcepFactories.getGenericReader();
PcepMessage message = null;
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -486,14 +467,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest12() throws PcepParseException {
@@ -517,7 +496,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -526,14 +505,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,LSPA
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest13() throws PcepParseException {
@@ -558,7 +535,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -567,14 +544,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest14() throws PcepParseException {
@@ -600,7 +575,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -609,14 +584,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object, ERO object,LSPA
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest15() throws PcepParseException {
@@ -639,7 +612,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -648,14 +621,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,LSPA
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest16() throws PcepParseException {
@@ -679,7 +650,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -688,14 +659,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest17() throws PcepParseException {
@@ -720,7 +689,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -729,14 +698,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest18() throws PcepParseException {
@@ -760,7 +727,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -769,14 +736,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest19() throws PcepParseException {
@@ -801,7 +766,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -810,14 +775,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,
* Bandwidth , metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest20() throws PcepParseException {
@@ -842,7 +805,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -851,14 +814,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object, ERO object,
* Bandwidth , metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest21() throws PcepParseException {
@@ -880,7 +841,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -889,14 +850,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,
* Bandwidth , metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest22() throws PcepParseException {
@@ -919,7 +878,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -928,14 +887,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,
* Bandwidth , metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest23() throws PcepParseException {
@@ -959,7 +916,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -968,14 +925,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,
* Bandwidth , metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest24() throws PcepParseException {
@@ -998,7 +953,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1007,14 +962,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,
* Bandwidth , metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest25() throws PcepParseException {
@@ -1038,7 +991,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1047,14 +1000,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,
* LSPA object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest26() throws PcepParseException {
@@ -1079,7 +1030,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1088,14 +1039,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object, ERO object,
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest27() throws PcepParseException {
@@ -1116,7 +1065,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1125,14 +1074,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest28() throws PcepParseException {
@@ -1154,7 +1101,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1163,14 +1110,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object,
* lspa object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest29() throws PcepParseException {
@@ -1195,7 +1140,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1204,14 +1149,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object,
* bandwidth object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest30() throws PcepParseException {
@@ -1235,7 +1178,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1244,14 +1187,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object,
* metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest31() throws PcepParseException {
@@ -1275,7 +1216,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1284,14 +1225,12 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
/**
* This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object,
* Metric object in PcepUpdate message.
- *
- * @throws PcepParseException while parsing PCEP message
*/
@Test
public void pcepUpdateMsgTest32() throws PcepParseException {
@@ -1317,7 +1256,7 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcepUpdateMsg", message instanceof PcepUpdateMsg);
+ assertThat(message, sameInstance((PcepUpdateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
@@ -1326,7 +1265,7 @@
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
- Assert.assertArrayEquals("PcepUpdatemsg messages are not equal", updateMsg, testupdateMsg);
+ assertThat(testupdateMsg, is(updateMsg));
}
}