From 5d2557714cf0966ff213a39a83ecbd971ccd4a8a Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 30 Sep 2023 10:38:15 -0400 Subject: [PATCH] Proper use of JUnit APIs --- .../org/apache/commons/csv/issues/JiraCsv248Test.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 84d274ac..d0a10300 100644 --- a/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java +++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java @@ -20,6 +20,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.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; @@ -70,12 +71,7 @@ public class JiraCsv248Test { assertFalse(rec.isSet("A")); assertEquals(0, rec.toMap().size()); // This will throw - try { - rec.get("A"); - org.junit.jupiter.api.Assertions.fail("Access by name is not expected after deserialisation"); - } catch (final IllegalStateException expected) { - // OK - } + assertThrows(IllegalStateException.class, () -> rec.get("A")); } } }