From 1cadf2c9b6c109a7745bff925f9a107699d1abbd Mon Sep 17 00:00:00 2001
From: Don Brutzman <brutzman@nps.edu>
Date: Sat, 29 Aug 2020 13:59:37 -0700
Subject: [PATCH] include test for matching pdu getMarshalledSize()

---
 test/edu/nps/moves/dis7/CommentPdusTest.java    | 6 ++++++
 test/edu/nps/moves/dis7/EntityStatePduTest.java | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/edu/nps/moves/dis7/CommentPdusTest.java b/test/edu/nps/moves/dis7/CommentPdusTest.java
index c25fa8e6bb..67e7fcabe5 100644
--- a/test/edu/nps/moves/dis7/CommentPdusTest.java
+++ b/test/edu/nps/moves/dis7/CommentPdusTest.java
@@ -69,6 +69,12 @@ public class CommentPdusTest
   {
      sendPdu(newPdu); // will wait a while
      assertTrue(receivedPdu != null, "No response from network receiver");
+     String marshallMismatchMessage = 
+        "Marshalled size mismatch," +
+            "sent (" +      newPdu.getMarshalledSize() + " bytes) and " +
+        "recieved (" + receivedPdu.getMarshalledSize() + " bytes)";
+     // https://stackoverflow.com/questions/20631621/cannot-find-symbol-assertequals/20631672
+     assertEquals(newPdu.getMarshalledSize(), receivedPdu.getMarshalledSize(), marshallMismatchMessage);
      assertTrue(compare(newPdu,receivedPdu), "Comparison failed");
      receivedPdu = null; // ensure cleared prior to next test
   }
diff --git a/test/edu/nps/moves/dis7/EntityStatePduTest.java b/test/edu/nps/moves/dis7/EntityStatePduTest.java
index d245f8f466..f86937e280 100644
--- a/test/edu/nps/moves/dis7/EntityStatePduTest.java
+++ b/test/edu/nps/moves/dis7/EntityStatePduTest.java
@@ -82,10 +82,11 @@ public class EntityStatePduTest
   {
      sendPdu(newPdu); // will wait a while
      assertTrue(receivedPdu != null,         "No response from network receive");
-     assertTrue(compare(newPdu,receivedPdu), "Comparison failed");
-     assertEqual(newPdu.getMarshalledSize(),receivedPdu),getMarshalledSize(),"Marshalled size mismatch," +
+     assertEquals(newPdu.getMarshalledSize(),receivedPdu.getMarshalledSize(),
+        "Marshalled size mismatch," +
             "sent (" +      newPdu.getMarshalledSize() + " bytes) and " +
         "recieved (" + receivedPdu.getMarshalledSize() + " bytes)");
+     assertTrue(compare(newPdu,receivedPdu), "Comparison failed");
      receivedPdu = null; // ensure cleared prior to next test
   }
   
-- 
GitLab