Package org.jmock.integration.junit4

Examples of org.jmock.integration.junit4.JUnit4Mockery


import java.io.File;

public class DefaultInitScriptFinderTest {
    @Test
    public void testFindScripts() {
        JUnit4Mockery context = new JUnit4Mockery();

        final GradleInternal gradleMock = context.mock(GradleInternal.class);
        final StartParameter testStartParameter = new StartParameter();
        testStartParameter.addInitScript(new File("some init script"));
        testStartParameter.addInitScript(new File("/path/to/another init script"));

        context.checking(new Expectations() {{
            allowing(gradleMock).getStartParameter();
            will(returnValue(testStartParameter));
        }});

        List<ScriptSource> sourceList = new DefaultInitScriptFinder().findScripts(gradleMock);
View Full Code Here


    private TaskView mySubProject2Compile;
    private JUnit4Mockery context;

    @Before
    public void setUp() throws Exception {
        context = new JUnit4Mockery();

        Task subsubCompileTask = TestUtility.createTask(context, "compile", "compile description");
        Task subsubLibTask = TestUtility.createTask(context, "lib", "lib description");
        Task subsubDocTask = TestUtility.createTask(context, "doc", "doc description");
        Project subsubProject = TestUtility.createMockProject(context, "mysubsubproject", "filepath3", 2, null,
View Full Code Here

    private TaskView mySubProject2Lib;
    private TaskView mySubProject2doc;
    private TaskView mySubProject2Compile;

    protected void setUp() throws Exception {
        JUnit4Mockery context = new JUnit4Mockery();

        Task subsubCompileTask = TestUtility.createTask(context, "compile", "compile description");
        Task subsubLibTask = TestUtility.createTask(context, "lib", "lib description");
        Task subsubDocTask = TestUtility.createTask(context, "doc", "doc description");
        Project subsubProject = TestUtility.createMockProject(context, "mysubsubproject", "filepath3", 2, null,
View Full Code Here

    private TaskView mySubProject2Compile;
    private JUnit4Mockery context;

    @Before
    public void setUp() throws Exception {
        context = new JUnit4Mockery();

        Task subsubCompileTask = TestUtility.createTask(context, "compile", "compile description");
        Task subsubLibTask = TestUtility.createTask(context, "lib", "lib description");
        Task subsubDocTask = TestUtility.createTask(context, "doc", "doc description");
        Project subsubProject = TestUtility.createMockProject(context, "mysubsubproject", "filepath3", 2, null,
View Full Code Here

public class InitScriptHandlerTest {

    @Test
    public void testExecuteScripts() {
        JUnit4Mockery context = new JUnit4Mockery();

        final InitScriptFinder finderMock = context.mock(InitScriptFinder.class);
        final InitScriptProcessor processorMock = context.mock(InitScriptProcessor.class);
        final GradleInternal gradleMock = context.mock(GradleInternal.class);
        final ScriptSource source1Mock = context.mock(ScriptSource.class, "source 1");
        final ScriptSource source2Mock = context.mock(ScriptSource.class, "source 2");
        final List<ScriptSource> testSources = new ArrayList<ScriptSource>();
        testSources.add(source1Mock);
        testSources.add(source2Mock);

        context.checking(new Expectations() {{
            one(finderMock).findScripts(gradleMock);
            will(returnValue(testSources));
            one(processorMock).process(source1Mock, gradleMock);
            one(processorMock).process(source2Mock, gradleMock);
        }});
View Full Code Here

public class EventUtilTest {

    protected Mockery context;

    public EventUtilTest() {
        this.context = new JUnit4Mockery();
    }
View Full Code Here

        TopologyConnectorServlet servlet = new TopologyConnectorServlet();
        PrivateAccessor.setField(servlet, "config", config);
        PrivateAccessor.setField(servlet, "clusterViewService", clusterViewService);
        PrivateAccessor.setField(servlet, "announcementRegistry", announcementRegistry);

        Mockery context = new JUnit4Mockery();
        final HttpService httpService = context.mock(HttpService.class);
        context.checking(new Expectations() {
            {
                allowing(httpService).registerServlet(with(any(String.class)),
                        with(any(Servlet.class)),
                        with(any(Dictionary.class)),
                        with(any(HttpContext.class)));
View Full Code Here

      return mockResourceResolverFactory(null);
    }

    public static ResourceResolverFactory mockResourceResolverFactory(final SlingRepository repositoryOrNull)
            throws Exception {
        Mockery context = new JUnit4Mockery();

        final ResourceResolverFactory resourceResolverFactory = context
                .mock(ResourceResolverFactory.class);
        // final ResourceResolver resourceResolver = new MockResourceResolver();
        // final ResourceResolver resourceResolver = new
        // MockedResourceResolver();

        context.checking(new Expectations() {
            {
                allowing(resourceResolverFactory)
                        .getAdministrativeResourceResolver(null);
                will(new Action() {
View Full Code Here

        return resourceResolverFactory;
    }

    public static SlingSettingsService mockSlingSettingsService(
            final String slingId) {
        Mockery context = new JUnit4Mockery();

        final SlingSettingsService settingsService = context
                .mock(SlingSettingsService.class);
        context.checking(new Expectations() {
            {
                allowing(settingsService).getSlingId();
                will(returnValue(slingId));
            }
        });
View Full Code Here

        });
        return settingsService;
    }

    public static ComponentContext mockComponentContext() {
        Mockery context = new JUnit4Mockery();
        final BundleContext bc = context.mock(BundleContext.class);
        context.checking(new Expectations() {
            {
                allowing(bc).registerService(with(any(String.class)),
                        with(any(Object.class)), with(any(Dictionary.class)));
                will(VoidAction.INSTANCE);
            }
        });

        final ComponentContext cc = context.mock(ComponentContext.class);
        context.checking(new Expectations() {
            {
                allowing(cc).getProperties();
                will(returnValue(new Properties()));

                allowing(cc).getBundleContext();
View Full Code Here

TOP

Related Classes of org.jmock.integration.junit4.JUnit4Mockery

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.