Examples of ReturnStub


Examples of org.jmock.core.stub.ReturnStub

        expectDefaultArguments( commandLineMock );

        Mock mock = new Mock( CommandLineFactory.class );

        mock.expects( new InvokeOnceMatcher() ).method( "createCommandLine" ).with( new IsEqual( "mvn" ) ).will(
            new ReturnStub( commandLineMock.proxy() ) );

        executor.setCommandLineFactory( (CommandLineFactory) mock.proxy() );

        try
        {
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        expectDefaultArguments( commandLineMock );

        Mock mock = new Mock( CommandLineFactory.class );

        mock.expects( new InvokeOnceMatcher() ).method( "createCommandLine" ).with( new IsEqual( "mvn" ) ).will(
            new ReturnStub( commandLineMock.proxy() ) );

        executor.setCommandLineFactory( (CommandLineFactory) mock.proxy() );

        try
        {
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

    {
        String[] args = new String[]{"clean", "integration-test", "--no-plugin-updates", "--batch-mode"};
        for ( int i = args.length - 1; i >= 0; i-- )
        {
            commandLineMock.expects( new InvokeOnceMatcher() ).method( "createArgument" ).will(
                new ReturnStub( createArgumentValueMock( args[i] ) ) );
        }
    }
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        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

Examples of org.jmock.core.stub.ReturnStub

    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 )
        {
            mockProcess.expects( new InvokeOnceMatcher() ).method( "exitValue" ).will(
                new ReturnStub( new Integer( exitCode ) ) );
        }
        return (Process) mockProcess.proxy();
    }
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Mock scmProviderMock = new Mock( ScmProvider.class );
        constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
            new IsInstanceOf( ScmTag.class )};
        scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
            new ReturnStub( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) ) );

        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( (ScmProvider) scmProviderMock.proxy() );

        releaseManager.perform( releaseDescriptor, new DefaultReleaseEnvironment(), createReactorProjects() );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Mock scmProviderMock = new Mock( ScmProvider.class );
        constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
            new IsInstanceOf( ScmTag.class )};
        scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
            new ReturnStub( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) ) );

        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( (ScmProvider) scmProviderMock.proxy() );

        releaseDescriptor.setUseReleaseProfile( false );
View Full Code Here

Examples of org.jmock.stub.ReturnStub

import org.jmock.stub.VoidStub;

public class InvokableFactory {

    public Invokable createReturnStub(String methodName, InvocationMatcher arguments, Object result) {
        return new InvocationMocker(methodName, arguments, new ReturnStub(result));
    }
View Full Code Here

Examples of org.jmock.stub.ReturnStub

    public Invokable createReturnStub(String methodName, InvocationMatcher arguments, Object result) {
        return new InvocationMocker(methodName, arguments, new ReturnStub(result));
    }

    public Invokable createReturnExpectation(String methodName, InvocationMatcher arguments, Object result) {
        return callOnce(new InvocationMocker(methodName, arguments, new ReturnStub(result)));
    }
View Full Code Here

Examples of org.jmock.stub.ReturnStub

    Invocation invocation = new Invocation("ignoredName", new Class[0], void.class, new Object[0]);

    public void testReturnStub() throws Throwable {
        final String RESULT = "result";

        assertSame("Should be the same result object", RESULT, new ReturnStub(RESULT).invoke(invocation));
    }
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.