From eb8c336fb834de8eed8b2cc54da30610b5780c45 Mon Sep 17 00:00:00 2001
From: brutzman <brutzman@nps.edu>
Date: Sun, 17 Oct 2021 09:29:37 -0700
Subject: [PATCH] Warning about assertion count failing if more than one
 pduLog/PduCapture*.dislog file is present

---
 .../nps/moves/dis7/AllPduRoundTripTest.java   | 30 +++++++++++--------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java
index a4e34f37fc..f28f9b9341 100644
--- a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java
+++ b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java
@@ -205,10 +205,13 @@ public class AllPduRoundTripTest
 
   private void testForEquals() throws Exception
   {
+    // TODO set sender and receiver to single file
+    System.out.println("*** Warning: ensure no prior dislog files are present in pduLog directory or assertion count of replay will fail.");
+    
     assertEquals(pdusSent.size(), pdusReceived.size(), "Different number of pdus received than sent");
-    assertIterableEquals(pdusSent, pdusReceived, "Sent and received pdus not identical");
     
-    // TODO is this sufficient?  has each PDU value been compared as well?
+    // TODO is this sufficient?  has each PDU value been fully compared as well?
+    assertIterableEquals(pdusSent, pdusReceived, "Sent and received pdus not identical");
   }
 
   private void getAllFromRecorder(Semaphore sem) throws Exception
@@ -228,13 +231,14 @@ public class AllPduRoundTripTest
     });
   }
 
-  private void testRecorderForEquals() throws Exception
-  {
-    assertEquals(pdusSent.size(), pdusRead.size(), "Different number of pdus sent than read");
-    assertIterableEquals(pdusSent, pdusRead, "Sent and read pdus not identical");
-    
-    // TODO is this sufficient?  has each PDU value been compared as well?
-  }
+    private void testRecorderForEquals() throws Exception 
+    {
+        // TODO this will fail if prior dislog files are present in pduLog directory, ignore them to make it less brittle
+        assertEquals(pdusSent.size(), pdusRead.size(), "Different number of pdus sent than read");
+        assertIterableEquals(pdusSent, pdusRead, "Sent and read pdus not identical");
+
+        // TODO is this sufficient?  has each PDU value been compared as well?
+    }
   
   private static void sleep(long ms) {
     try {
@@ -244,8 +248,8 @@ public class AllPduRoundTripTest
     }
   }
   
-  public static void main(String[] args)
-  {
-    new AllPduRoundTripTest().testRoundTripAllPdus();
-  }
+    public static void main(String[] args)
+    {
+        new AllPduRoundTripTest().testRoundTripAllPdus();
+    }
 }
-- 
GitLab