Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
janolaveide committed Jun 13, 2021
1 parent d38a70c commit c933b7a
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.mockito.stubbing.Answer;

import no.nav.vedtak.exception.IntegrasjonException;
import no.nav.vedtak.exception.TekniskException;

@ExtendWith(MockitoExtension.class)
public class TestExceptionTranslatingInvoker {
Expand All @@ -32,4 +33,17 @@ public String answer(InvocationOnMock invocation) throws Throwable {
assertThrows(IntegrasjonException.class, () -> new ExceptionTranslatingInvoker().invoke(i, String.class));
}

@Test
void testInvocationTranslationNonDefault() {
when(i.invoke(String.class)).thenAnswer(new Answer<String>() {

@Override
public String answer(InvocationOnMock invocation) throws Throwable {
throw new NullPointerException("OOPS");
}
});
assertThrows(TekniskException.class,
() -> new ExceptionTranslatingInvoker(TekniskException.class).invoke(i, String.class, NullPointerException.class));
}

}

0 comments on commit c933b7a

Please sign in to comment.