Package org.jmock

Examples of org.jmock.Expectations


        final ScriptPluginFactory scriptPluginFactory = context.mock(ScriptPluginFactory.class);
        final ScriptPlugin configurer = context.mock(ScriptPlugin.class);
        final ScriptSource initScriptMock = context.mock(ScriptSource.class);
        final GradleInternal gradleMock = context.mock(GradleInternal.class);

        context.checking(new Expectations() {{
            one(scriptPluginFactory).create(initScriptMock);
            will(returnValue(configurer));

            one(configurer).setClasspathClosureName("initscript");
            one(configurer).setScriptBaseClass(InitScript.class);
View Full Code Here


        System.setProperty("line.separator", eol);
    }

    @Test
    public void logsEachLineAsASeparateLogMessage() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute("line 1");
            one(action).execute("line 2");
        }});

        outputStream.write(String.format("line 1%nline 2%n").getBytes());
View Full Code Here

        outputStream.write(String.format("line 1%nline 2%n").getBytes());
    }

    @Test
    public void canReceiveEachLineWithSeparator() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute(String.format("line 1%n"));
            one(action).execute(String.format("line 2%n"));
        }});

        outputStream = new LineBufferingOutputStream(action, true);
View Full Code Here

        outputStream.write(String.format("line 1%nline 2%n").getBytes());
    }

    @Test
    public void logsEmptyLines() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute("");
            one(action).execute("");
        }});

        outputStream.write(String.format("%n%n").getBytes());
View Full Code Here

        outputStream.write(String.format("%n%n").getBytes());
    }

    @Test
    public void handlesSingleCharacterLineSeparator() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute("line 1");
            one(action).execute("line 2");
        }});

        System.setProperty("line.separator", "-");
View Full Code Here

        outputStream.write(String.format("line 1-line 2-").getBytes());
    }
   
    @Test
    public void handlesMultiCharacterLineSeparator() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute("line 1");
            one(action).execute("line 2");
        }});

        System.setProperty("line.separator", "----");
View Full Code Here

        outputStream.write(String.format("line 1----line 2----").getBytes());
    }

    @Test
    public void logsLineWhichIsLongerThanInitialBufferLength() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute("a line longer than 8 bytes long");
            one(action).execute("line 2");
        }});
        outputStream.write(String.format("a line longer than 8 bytes long%n").getBytes());
        outputStream.write("line 2".getBytes());
View Full Code Here

        outputStream.close();
    }

    @Test
    public void logsPartialLineOnFlush() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute("line 1");
        }});

        outputStream.write("line 1".getBytes());
        outputStream.flush();
View Full Code Here

        outputStream.flush();
    }

    @Test
    public void logsPartialLineOnClose() throws IOException {
        context.checking(new Expectations() {{
            one(action).execute("line 1");
        }});
        outputStream.write("line 1".getBytes());
        outputStream.close();
    }
View Full Code Here

    @Test
    public void delegatesWhenSettingsFileNotSpecifiedInStartParam() {
        final StartParameter parameter = new StartParameter();
        final File settingsDir = new File("settings dir");

        context.checking(new Expectations() {{
            one(delegate).find(parameter);
            will(returnValue(new SettingsLocation(settingsDir, settingsScriptSource)));
        }});

        SettingsLocation settingsLocation = settingsFinder.find(parameter);
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.