Package org.mockito

Examples of org.mockito.ArgumentCaptor


    }

    public void setUp()
    {
        m_bundleContext = (BundleContext) Mockito.mock(BundleContext.class);
        ArgumentCaptor argument = ArgumentCaptor.forClass(ServiceListener.class);
        m_service = new ConnectorServiceImpl(m_bundleContext);
        try
        {
            ((BundleContext) Mockito.verify(m_bundleContext)).addServiceListener((ServiceListener) argument.capture(),
                    Mockito.anyString());
        } catch (InvalidSyntaxException e)
        {
            fail();
        }
        // getting from captor serviceListener which listen to ConnectionFactory service
        m_serviceListener = (ServiceListener) argument.getValue();
    }
View Full Code Here


            }

            final Method method = mock.getClass().getDeclaredMethod(methodName, types);
            method.setAccessible(true);

            ArgumentCaptor captor = ArgumentCaptor.forClass(argType);
            method.invoke(verify(mock, mode), replace(args, argIndex, captor));
            return captor.getValue();
        } catch (IllegalAccessException ex) {
            throw new RuntimeException(ex);
        } catch (IllegalArgumentException ex) {
            throw new RuntimeException(ex);
        } catch (InvocationTargetException ex) {
View Full Code Here

TOP

Related Classes of org.mockito.ArgumentCaptor

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.