Skip to content

Commit 09855ab

Browse files
committed
Issue #66 - Add test for default order() method
1 parent 1107820 commit 09855ab

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/test/java/ch/powerunit/extensions/exceptions/ExceptionMapperTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,33 @@ public void testForOrderedExceptionsNone() {
184184
}
185185

186186
@Test
187-
public void testForOrderedOneElement() {
187+
public void testForOrderedOneElementV1() {
188188
assertThatFunction(
189189
ExceptionMapper.forOrderedExceptions(List.of(
190190
ExceptionMapper.forException(RuntimeException.class, e -> new WrappedException("testme1"), 2))),
191191
new IllegalArgumentException("test"))
192192
.is(both(exceptionMessage("testme1")).and(instanceOf(WrappedException.class)));
193193
}
194+
195+
@Test
196+
public void testForOrderedOneElementV2Default() {
197+
assertThatFunction(
198+
ExceptionMapper.forOrderedExceptions(List.of(new ExceptionMapper() {
199+
200+
@Override
201+
public RuntimeException apply(Exception t) {
202+
return new WrappedException("testme1");
203+
}
204+
205+
@Override
206+
public Class<? extends Exception> targetException() {
207+
return Exception.class;
208+
}
209+
210+
})),
211+
new IllegalArgumentException("test"))
212+
.is(both(exceptionMessage("testme1")).and(instanceOf(WrappedException.class)));
213+
}
194214

195215
@Test
196216
public void testForOrderedTwoElement() {

0 commit comments

Comments
 (0)