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


##########
src/test/java/org/apache/commons/imaging/roundtrip/NullParametersRoundtripTest.java:
##########
@@ -38,13 +38,17 @@ public static Stream<FormatInfo> data() {
     @MethodSource("data")
     public void testNullParametersRoundtrip(final FormatInfo formatInfo) 
throws Exception {
         final BufferedImage testImage = TestImages.createFullColorImage(1, 1);
-        final File temp1 = Files.createTempFile("nullParameters.", "." + 
formatInfo.format.getDefaultExtension()).toFile();
-        Imaging.writeImage(testImage, temp1, formatInfo.format);
-        Imaging.getImageInfo(temp1);
-        Imaging.getImageSize(temp1);
-        Imaging.getMetadata(temp1);
-        Imaging.getICCProfile(temp1);
-        final BufferedImage imageRead = Imaging.getBufferedImage(temp1);
+        final byte[] temp1;
+        try (ByteArrayOutputStream byteArrayOutputStream = new 
ByteArrayOutputStream()) {
+            Imaging.writeImage(testImage, byteArrayOutputStream, 
formatInfo.format);
+            temp1 = byteArrayOutputStream.toByteArray();
+        }
+        final String filename = "nullParameters." + 
formatInfo.format.getDefaultExtension();
+        Imaging.getImageInfo(new ByteArrayInputStream(temp1), filename);
+        Imaging.getImageSize(new ByteArrayInputStream(temp1), filename);
+        Imaging.getMetadata(new ByteArrayInputStream(temp1), filename);
+        Imaging.getICCProfile(new ByteArrayInputStream(temp1), filename);

Review Comment:
   Hmmm, we cannot re-use the same `ByteArrayInputStream` right? :thinking: 
would be nicer if we closed these streams at least. Maybe we have to split it 
into separated test methods?



-- 
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