From 8fa6859e717402d6e48801305230550846bd5c54 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Wed, 19 Oct 2022 19:11:15 +0100 Subject: [PATCH 1/2] JUnit v5 api dependency to test --- test/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/pom.xml b/test/pom.xml index fcc93eab..2711d64d 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -59,6 +59,11 @@ commons-lang3 test + + org.junit.jupiter + junit-jupiter-api + test + From 523ecc6e7d7762bbb21a569d97378027bd982178 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Wed, 19 Oct 2022 19:20:08 +0100 Subject: [PATCH 2/2] JUnit5 assertThrows AnnotationBuilderTest --- .../commons/proxy2/stub/AnnotationBuilderTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/src/test/java/org/apache/commons/proxy2/stub/AnnotationBuilderTest.java b/test/src/test/java/org/apache/commons/proxy2/stub/AnnotationBuilderTest.java index 93f6dc64..17eaad3e 100644 --- a/test/src/test/java/org/apache/commons/proxy2/stub/AnnotationBuilderTest.java +++ b/test/src/test/java/org/apache/commons/proxy2/stub/AnnotationBuilderTest.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Collections; import java.util.HashMap; @@ -137,11 +138,12 @@ protected void train(CustomAnnotation trainee) assertArrayEquals(new FiniteValues[] { FiniteValues.TWO }, nestingAnnotation.children()[1].finiteValues()); } - @Test(expected = IllegalArgumentException.class) + @Test public void testBadMemberMap() { - AnnotationBuilder.of(CustomAnnotation.class).withMembers( - Collections.singletonMap("annString", Integer.valueOf(100))); + assertThrows(IllegalArgumentException.class, () -> + AnnotationBuilder.of(CustomAnnotation.class).withMembers( + Collections.singletonMap("annString", Integer.valueOf(100)))); } public @interface NestingAnnotation @@ -167,4 +169,4 @@ public enum FiniteValues ONE, TWO, THREE; } -} \ No newline at end of file +}