Use Assertions.assertInstanceOf()
This commit is contained in:
parent
55a885ec2d
commit
e65d31b89a
|
@ -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.assertArrayEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
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.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
@ -270,7 +271,7 @@ public class CSVRecordTest {
|
||||||
final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
||||||
try (ObjectInputStream ois = new ObjectInputStream(in)) {
|
try (ObjectInputStream ois = new ObjectInputStream(in)) {
|
||||||
final Object object = ois.readObject();
|
final Object object = ois.readObject();
|
||||||
assertTrue(object instanceof CSVRecord);
|
assertInstanceOf(CSVRecord.class, object);
|
||||||
final CSVRecord rec = (CSVRecord) object;
|
final CSVRecord rec = (CSVRecord) object;
|
||||||
assertEquals(1L, rec.getRecordNumber());
|
assertEquals(1L, rec.getRecordNumber());
|
||||||
assertEquals("One", rec.get(0));
|
assertEquals("One", rec.get(0));
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
package org.apache.commons.csv;
|
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.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.assertArrayEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
|
@ -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.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
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.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
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)) {
|
try (InputStream in = getTestInput(); final ObjectInputStream ois = new ObjectInputStream(in)) {
|
||||||
final Object object = ois.readObject();
|
final Object object = ois.readObject();
|
||||||
assertTrue(object instanceof CSVRecord);
|
assertInstanceOf(CSVRecord.class, object);
|
||||||
final CSVRecord rec = (CSVRecord) object;
|
final CSVRecord rec = (CSVRecord) object;
|
||||||
assertEquals(1L, rec.getRecordNumber());
|
assertEquals(1L, rec.getRecordNumber());
|
||||||
assertEquals("One", rec.get(0));
|
assertEquals("One", rec.get(0));
|
||||||
|
|
Loading…
Reference in New Issue