Add more serialization assertions
[controller.git] / opendaylight / md-sal / cds-access-api / src / test / java / org / opendaylight / controller / cluster / access / concepts / FrontendTypeTest.java
index 43ffa19c49e38661182849de606592df1bde79b1..0cfd887d565dff9bc32f7aa136a795180b9d6499 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
@@ -31,19 +33,26 @@ public class FrontendTypeTest extends AbstractIdentifierTest<FrontendType> {
         return FrontendType.forName("type-1");
     }
 
+    @Override
+    int expectedSize() {
+        return 104;
+    }
+
     @Test
     public void testWriteToReadFrom() throws Exception {
         final FrontendType type = FrontendType.forName("type");
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         final DataOutputStream dos = new DataOutputStream(baos);
         type.writeTo(dos);
-        final FrontendType read =
-                FrontendType.readFrom(new DataInputStream(new ByteArrayInputStream(baos.toByteArray())));
+
+        final byte[] bytes = baos.toByteArray();
+        assertEquals(8, bytes.length);
+        final FrontendType read = FrontendType.readFrom(new DataInputStream(new ByteArrayInputStream(bytes)));
         Assert.assertEquals(type, read);
     }
 
     @Test
-    public void testCompareTo() throws Exception {
+    public void testCompareTo() {
         Assert.assertTrue(object().compareTo(equalObject()) == 0);
         Assert.assertTrue(object().compareTo(differentObject()) < 0);
     }