Class ThrowsMethodExceptionAnswer

java.lang.Object
org.opendaylight.yangtools.testutils.mockito.ThrowsMethodExceptionAnswer
All Implemented Interfaces:
Serializable, org.mockito.stubbing.Answer<Object>

@Beta public final class ThrowsMethodExceptionAnswer extends Object implements org.mockito.stubbing.Answer<Object>, Serializable
Mockito Answer which for un-stubbed methods throws an UnstubbedMethodException (instead of Mockito's default of returning null).

Usage:

 import static ...testutils.mockito.MoreAnswers.exception;

 Mockito.mock(YourInterface.class, exception())
 
Author:
Michael Vorburger
See Also:
  • Method Details

    • answer

      public Void answer(org.mockito.invocation.InvocationOnMock invocation)
      Specified by:
      answer in interface org.mockito.stubbing.Answer<Object>