From e65d31b89a9787104b09e9239bc30895b7212314 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 1 Sep 2024 18:50:30 -0400 Subject: [PATCH] Use Assertions.assertInstanceOf() --- src/test/java/org/apache/commons/csv/CSVRecordTest.java | 3 ++- .../org/apache/commons/csv/ExtendedBufferedReaderTest.java | 2 +- .../java/org/apache/commons/csv/issues/JiraCsv248Test.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/apache/commons/csv/CSVRecordTest.java b/src/test/java/org/apache/commons/csv/CSVRecordTest.java index 0da62fe5..65698f58 100644 --- a/src/test/java/org/apache/commons/csv/CSVRecordTest.java +++ b/src/test/java/org/apache/commons/csv/CSVRecordTest.java @@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -270,7 +271,7 @@ public class CSVRecordTest { final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); try (ObjectInputStream ois = new ObjectInputStream(in)) { final Object object = ois.readObject(); - assertTrue(object instanceof CSVRecord); + assertInstanceOf(CSVRecord.class, object); final CSVRecord rec = (CSVRecord) object; assertEquals(1L, rec.getRecordNumber()); assertEquals("One", rec.get(0)); diff --git a/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java b/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java index 5e785124..07bbae19 100644 --- a/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java +++ b/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java @@ -17,8 +17,8 @@ package org.apache.commons.csv; -import static org.apache.commons.io.IOUtils.EOF; import static org.apache.commons.csv.Constants.UNDEFINED; +import static org.apache.commons.io.IOUtils.EOF; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java index d0a10300..7db2977f 100644 --- a/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java +++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java @@ -19,6 +19,7 @@ package org.apache.commons.csv.issues; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -54,7 +55,7 @@ public class JiraCsv248Test { // } try (InputStream in = getTestInput(); final ObjectInputStream ois = new ObjectInputStream(in)) { final Object object = ois.readObject(); - assertTrue(object instanceof CSVRecord); + assertInstanceOf(CSVRecord.class, object); final CSVRecord rec = (CSVRecord) object; assertEquals(1L, rec.getRecordNumber()); assertEquals("One", rec.get(0));