Package org.jmock

Examples of org.jmock.Expectations


    @Test
    public void notifiesListenerOnFailure() {
        final RuntimeException failure = new RuntimeException();

        context.checking(new Expectations() {{
            allowing(state).getExecuted();
            will(returnValue(false));

            Sequence sequence = context.sequence("seq");
View Full Code Here


    private final ProjectStateInternal state = context.mock(ProjectStateInternal.class);
    private final BuildScriptProcessor evaluator = new BuildScriptProcessor(configurerFactory);

    @Before
    public void setUp() {
        context.checking(new Expectations() {{
            allowing(project).getBuildScriptSource();
            will(returnValue(scriptSource));
            ignoring(scriptSource);
        }});
    }
View Full Code Here

        }});
    }

    @Test
    public void configuresProjectUsingBuildScript() {
        context.checking(new Expectations() {{
            one(configurerFactory).create(scriptSource);
            will(returnValue(scriptPlugin));

            one(scriptPlugin).apply(project);
        }});
View Full Code Here

        source = new ImportsScriptSource(backingSource, importsReader);
    }
   
    @Test
    public void prependsImportsToScriptText() {
        context.checking(new Expectations() {{
            one(backingSource).getResource();
            will(returnValue(resource));

            one(resource).getText();
            will(returnValue("<content>"));
View Full Code Here

        assertThat(source.getResource().getText(), equalTo("<content>\n<imports>"));
    }

    @Test
    public void doesNotPrependImportsWhenScriptHasNoText() {
        context.checking(new Expectations(){{
            one(backingSource).getResource();
            will(returnValue(resource));

            one(resource).getText();
            will(returnValue(""));
View Full Code Here

    @Test
    public void setName() {
        final String newName = "newName";
        final IProjectDescriptorRegistry projectDescriptorRegistryMock = context.mock(IProjectDescriptorRegistry.class);
        projectDescriptor.setProjectDescriptorRegistry(projectDescriptorRegistryMock);
        context.checking(new Expectations() {{
            one(projectDescriptorRegistryMock).changeDescriptorPath(Path.path(TEST_NAME), Path.path(Project.PATH_SEPARATOR + newName));
        }});
        projectDescriptor.setName(newName);
        assertEquals(newName, projectDescriptor.getName());
    }
View Full Code Here

        assertThat(source.getResource().getText(), equalTo(""));
    }

    @Test
    public void delegatesAllOtherMethodsToBackingScriptSource() {
        context.checking(new Expectations(){{
            one(backingSource).getClassName();
            will(returnValue("classname"));

            one(backingSource).getDisplayName();
            will(returnValue("description"));
View Full Code Here

    @Test
    public void configuresATargetObjectUsingScript() {
        final Object target = new Object();

        context.checking(new Expectations() {{
            Sequence sequence = context.sequence("seq");
            ScriptSource sourceWithImportsMock = context.mock(ScriptSource.class, "imports");
            LoggingManagerInternal loggingManagerMock = context.mock(LoggingManagerInternal.class);

            one(loggingManagerFactoryMock).create();
View Full Code Here

    @Test
    public void configuresAScriptAwareObjectUsingScript() {
        final ScriptAware target = context.mock(ScriptAware.class);

        context.checking(new Expectations() {{
            Sequence sequence = context.sequence("seq");
            ScriptSource sourceWithImportsMock = context.mock(ScriptSource.class, "imports");
            LoggingManagerInternal loggingManagerMock = context.mock(LoggingManagerInternal.class);

            one(loggingManagerFactoryMock).create();
View Full Code Here

        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

TOP

Related Classes of org.jmock.Expectations

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.