Package org.jmock.cglib

Examples of org.jmock.cglib.Mock.expects()


    }

    private static Mock createMockCommandLine( File workingDirectory, Process process )
    {
        Mock commandLineMock = new Mock( Commandline.class );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "setWorkingDirectory" ).with(
            new IsEqual( workingDirectory.getAbsolutePath() ) );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "addEnvironment" ).with(
            new IsEqual( "MAVEN_TERMINATE_CMD" ), new IsEqual( "on" ) );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "execute" ).will( new ReturnStub( process ) );
View Full Code Here


    private static Mock createMockCommandLine( File workingDirectory, Process process )
    {
        Mock commandLineMock = new Mock( Commandline.class );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "setWorkingDirectory" ).with(
            new IsEqual( workingDirectory.getAbsolutePath() ) );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "addEnvironment" ).with(
            new IsEqual( "MAVEN_TERMINATE_CMD" ), new IsEqual( "on" ) );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "execute" ).will( new ReturnStub( process ) );

        return commandLineMock;
    }
View Full Code Here

        Mock commandLineMock = new Mock( Commandline.class );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "setWorkingDirectory" ).with(
            new IsEqual( workingDirectory.getAbsolutePath() ) );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "addEnvironment" ).with(
            new IsEqual( "MAVEN_TERMINATE_CMD" ), new IsEqual( "on" ) );
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "execute" ).will( new ReturnStub( process ) );

        return commandLineMock;
    }

    private static Commandline.Argument createArgumentValueMock( String value )
View Full Code Here

    }

    private static Commandline.Argument createArgumentValueMock( String value )
    {
        Mock mock = new Mock( Commandline.Argument.class );
        mock.expects( new InvokeOnceMatcher() ).method( "setValue" ).with( new IsEqual( value ) );
        return (Commandline.Argument) mock.proxy();
    }

    private static Commandline.Argument createArgumentLineMock( String value )
    {
View Full Code Here

    }

    private static Commandline.Argument createArgumentLineMock( String value )
    {
        Mock mock = new Mock( Commandline.Argument.class );
        mock.expects( new InvokeOnceMatcher() ).method( "setLine" ).with( new IsEqual( value ) );
        return (Commandline.Argument) mock.proxy();
    }

    private static Process createMockProcess( int exitCode )
    {
View Full Code Here

    }

    private static Process createMockProcess( int exitCode )
    {
        Mock mockProcess = new Mock( Process.class );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "getInputStream" ).will(
            new ReturnStub( new StringInputStream( "" ) ) );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "getErrorStream" ).will(
            new ReturnStub( new StringInputStream( "" ) ) );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "waitFor" ).will(
            new ReturnStub( new Integer( exitCode ) ) );
View Full Code Here

    private static Process createMockProcess( int exitCode )
    {
        Mock mockProcess = new Mock( Process.class );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "getInputStream" ).will(
            new ReturnStub( new StringInputStream( "" ) ) );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "getErrorStream" ).will(
            new ReturnStub( new StringInputStream( "" ) ) );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "waitFor" ).will(
            new ReturnStub( new Integer( exitCode ) ) );
        if ( exitCode != 0 )
        {
View Full Code Here

        Mock mockProcess = new Mock( Process.class );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "getInputStream" ).will(
            new ReturnStub( new StringInputStream( "" ) ) );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "getErrorStream" ).will(
            new ReturnStub( new StringInputStream( "" ) ) );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "waitFor" ).will(
            new ReturnStub( new Integer( exitCode ) ) );
        if ( exitCode != 0 )
        {
            mockProcess.expects( new InvokeOnceMatcher() ).method( "exitValue" ).will(
                new ReturnStub( new Integer( exitCode ) ) );
View Full Code Here

            new ReturnStub( new StringInputStream( "" ) ) );
        mockProcess.expects( new InvokeOnceMatcher() ).method( "waitFor" ).will(
            new ReturnStub( new Integer( exitCode ) ) );
        if ( exitCode != 0 )
        {
            mockProcess.expects( new InvokeOnceMatcher() ).method( "exitValue" ).will(
                new ReturnStub( new Integer( exitCode ) ) );
        }
        return (Process) mockProcess.proxy();
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.