This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 1e84a779 Better JUnit API usage
1e84a779 is described below

commit 1e84a779275fb05f701eb425e07c4ce6deda18af
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Aug 5 16:05:11 2023 -0400

    Better JUnit API usage
---
 .../commons/io/input/UnsynchronizedBufferedInputStreamTest.java     | 6 +++---
 .../commons/io/input/UnsynchronizedFilterInputStreamTest.java       | 5 +++--
 src/test/java/org/apache/commons/io/test/TestUtils.java             | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
index 715de5e5..f7fcba81 100644
--- 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
@@ -88,7 +88,7 @@ public class UnsynchronizedBufferedInputStreamTest {
      */
     @Test
     public void test_available() throws IOException {
-        assertTrue(is.available() == DATA.length(), "Returned incorrect number 
of available bytes");
+        assertEquals(DATA.length(), is.available(), "Returned incorrect number 
of available bytes");
 
         // Test that a closed stream throws an IOE for available()
         final BufferedInputStream bis = new BufferedInputStream(new 
ByteArrayInputStream(new byte[] { 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 
'l', 'd' }));
@@ -272,7 +272,7 @@ public class UnsynchronizedBufferedInputStreamTest {
     public void test_read() throws IOException {
         final InputStreamReader isr = new InputStreamReader(is);
         final int c = isr.read();
-        assertTrue(c == DATA.charAt(0), "read returned incorrect char");
+        assertEquals(DATA.charAt(0), c, "read returned incorrect char");
 
         final byte[] bytes = new byte[256];
         for (int i = 0; i < 256; i++) {
@@ -333,7 +333,7 @@ public class UnsynchronizedBufferedInputStreamTest {
         })) {
             bufin.read();
             final int result = bufin.read(new byte[2], 0, 2);
-            assertTrue(result == 1, () -> "Incorrect result: " + result);
+            assertEquals(1, result, () -> "Incorrect result: " + result);
         }
     }
 
diff --git 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
index fd33bee3..e09745a1 100644
--- 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
@@ -1,5 +1,6 @@
 package org.apache.commons.io.input;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
@@ -79,7 +80,7 @@ public class UnsynchronizedFilterInputStreamTest {
      */
     @Test
     public void test_available() throws IOException {
-        assertTrue(is.available() == DATA.length(), "Returned incorrect number 
of available bytes");
+        assertEquals(DATA.length(), is.available(), "Returned incorrect number 
of available bytes");
     }
 
     /**
@@ -117,7 +118,7 @@ public class UnsynchronizedFilterInputStreamTest {
     @Test
     public void test_read() throws IOException {
         final int c = is.read();
-        assertTrue(c == DATA.charAt(0), "read returned incorrect char");
+        assertEquals(DATA.charAt(0), c, "read returned incorrect char");
     }
 
     /**
diff --git a/src/test/java/org/apache/commons/io/test/TestUtils.java 
b/src/test/java/org/apache/commons/io/test/TestUtils.java
index cc9d7ff8..0620603d 100644
--- a/src/test/java/org/apache/commons/io/test/TestUtils.java
+++ b/src/test/java/org/apache/commons/io/test/TestUtils.java
@@ -132,7 +132,7 @@ public abstract class TestUtils {
                 while (-1 != n0) {
                     n0 = is0.read(buf0);
                     n1 = is1.read(buf1);
-                    assertTrue(n0 == n1,
+                    assertEquals(n0, n1,
                             "The files " + f0 + " and " + f1 +
                             " have differing number of bytes available (" + n0 
+ " vs " + n1 + ")");
 

Reply via email to