kinow commented on code in PR #271:
URL: https://github.com/apache/commons-imaging/pull/271#discussion_r1140757370


##########
src/test/java/org/apache/commons/imaging/roundtrip/ImageAsserts.java:
##########
@@ -99,4 +99,18 @@ static void assertEquals(final File a, final File b) throws 
IOException {
             Assertions.assertEquals(aByte, bByte);
         }
     }
+
+    static void assertEquals(byte[] aData, byte[] bData) {
+        for (int i = 0; i < aData.length; i++) {
+            final int aByte = 0xff & aData[i];
+            final int bByte = 0xff & bData[i];
+
+            if (aByte != bByte) {
+                Debug.debug("i: " + i);
+                Debug.debug("aByte: " + aByte + " (0x" + 
Integer.toHexString(aByte) + ')');
+                Debug.debug("bByte: " + bByte + " (0x" + 
Integer.toHexString(bByte) + ')');
+            }
+            Assertions.assertEquals(aByte, bByte);
+        }
+    }

Review Comment:
   I think the JUnit version should work too. Not sure if what 
`ImageAsserts#assertEquals(File, File)` is doing is necessary. It's reading the 
bytes from the stream, I assume, without handling `int` values (and thus having 
to apply a filter mask `0xff` to clear the other bits in the 32 byte-Java).
   
   The point here is that if the JUnit's `assertArrayEquals` work, it's better 
it's less code for us to test :+1: 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to