Skip to content

Commit 523ecc6

Browse files
committed
JUnit5 assertThrows AnnotationBuilderTest
1 parent 8fa6859 commit 523ecc6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/src/test/java/org/apache/commons/proxy2/stub/AnnotationBuilderTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.junit.Assert.assertEquals;
2222
import static org.junit.Assert.assertNotNull;
2323
import static org.junit.Assert.assertNull;
24+
import static org.junit.jupiter.api.Assertions.assertThrows;
2425

2526
import java.util.Collections;
2627
import java.util.HashMap;
@@ -137,11 +138,12 @@ protected void train(CustomAnnotation trainee)
137138
assertArrayEquals(new FiniteValues[] { FiniteValues.TWO }, nestingAnnotation.children()[1].finiteValues());
138139
}
139140

140-
@Test(expected = IllegalArgumentException.class)
141+
@Test
141142
public void testBadMemberMap()
142143
{
143-
AnnotationBuilder.of(CustomAnnotation.class).withMembers(
144-
Collections.singletonMap("annString", Integer.valueOf(100)));
144+
assertThrows(IllegalArgumentException.class, () ->
145+
AnnotationBuilder.of(CustomAnnotation.class).withMembers(
146+
Collections.singletonMap("annString", Integer.valueOf(100))));
145147
}
146148

147149
public @interface NestingAnnotation
@@ -167,4 +169,4 @@ public enum FiniteValues
167169
ONE, TWO, THREE;
168170
}
169171

170-
}
172+
}

0 commit comments

Comments
 (0)