Package org.mockito.listeners

Examples of org.mockito.listeners.InvocationListener



    @Test
    public void should_call_all_listener_when_mock_throws_exception() throws Exception {
        // given
        InvocationListener listener1 = mock(InvocationListener.class, "listener1");
        InvocationListener listener2 = mock(InvocationListener.class, "listener2");
        Foo foo = mock(Foo.class, withSettings().invocationListeners(listener1, listener2));
        doThrow(new OvenNotWorking()).when(foo).doSomething("cook");

        // when
        try {
View Full Code Here


public class ListenersLostOnResetMockTest {

    @Test
    public void listener() throws Exception {
        InvocationListener invocationListener = mock(InvocationListener.class);

        List mockedList = mock(List.class, withSettings().invocationListeners(invocationListener));
        reset(mockedList);

        mockedList.clear();
View Full Code Here


  @Test(expected = MockitoException.class)
  public void shouldThrowMockitoExceptionWhenInvocationHandlerThrowsAnything() throws Throwable {
    // given
    InvocationListener throwingListener = mock(InvocationListener.class);
    doThrow(new Throwable()).when(throwingListener).reportInvocation(any(MethodInvocationReport.class));
    MockHandlerImpl<?> handler = createCorrectlyStubbedHandler(throwingListener);

    // when
    handler.handle(invocation);
View Full Code Here

TOP

Related Classes of org.mockito.listeners.InvocationListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.