Examples of ReturnStub


Examples of org.jmock.core.stub.ReturnStub

        throws Exception
    {
        Mock mockPrompter = new Mock( Prompter.class );
        mockPrompter.expects( new InvokeOnceMatcher() ).method( "prompt" ).with( new IsAnything(),
                                                                                 new IsEqual( "artifactId-1.0" ) ).will(
            new ReturnStub( "tag-value" ) );
        phase.setPrompter( (Prompter) mockPrompter.proxy() );

        List<MavenProject> reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) );

        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
        releaseDescriptor.mapReleaseVersion( "groupId:artifactId", "1.0" );
        releaseDescriptor.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" );

        phase.execute( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );

        assertEquals( "Check tag", "tag-value", releaseDescriptor.getScmReleaseLabel() );

        releaseDescriptor = new ReleaseDescriptor();
        releaseDescriptor.mapReleaseVersion( "groupId:artifactId", "1.0" );
        releaseDescriptor.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" );

        mockPrompter.reset();
        mockPrompter.expects( new InvokeOnceMatcher() ).method( "prompt" ).with( new IsAnything(),
                                                                                 new IsEqual( "artifactId-1.0" ) ).will(
            new ReturnStub( "simulated-tag-value" ) );

        phase.simulate( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );

        assertEquals( "Check tag", "simulated-tag-value", releaseDescriptor.getScmReleaseLabel() );
    }
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

            new IsEqual( PREFIX + "release-label" )};
        scmProviderMock
            .expects( new InvokeOnceMatcher() )
            .method( "checkIn" )
            .with( arguments )
            .will( new ReturnStub( new CheckInScmResult( "...", Collections.singletonList( new ScmFile( rootProject
                       .getFile().getPath(), ScmFileStatus.CHECKED_IN ) ) ) ) );

       
       
        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

            new IsEqual( PREFIX + "release-label" )};
        scmProviderMock
            .expects( new InvokeOnceMatcher() )
            .method( "checkIn" )
            .with( arguments )
            .will( new ReturnStub( new CheckInScmResult( "...", Collections.singletonList( new ScmFile( rootProject
                       .getFile().getPath(), ScmFileStatus.CHECKED_IN ) ) ) ) );

        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( (ScmProvider) scmProviderMock.proxy() );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

            new IsEqual( "[maven-release-manager] prepare for next development iteration" )};
        scmProviderMock
            .expects( new InvokeOnceMatcher() )
            .method( "checkIn" )
            .with( arguments )
            .will( new ReturnStub( new CheckInScmResult( "...", Collections.singletonList( new ScmFile( rootProject
                       .getFile().getPath(), ScmFileStatus.CHECKED_IN ) ) ) ) );

        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( (ScmProvider) scmProviderMock.proxy() );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

            new IsEqual( PREFIX + "release-label" )};
        scmProviderMock
            .expects( new InvokeOnceMatcher() )
            .method( "checkIn" )
            .with( arguments )
            .will( new ReturnStub( new CheckInScmResult( "...", Collections.singletonList( new ScmFile( rootProject
                       .getFile().getPath(), ScmFileStatus.CHECKED_IN ) ) ) ) );

        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( (ScmProvider) scmProviderMock.proxy() );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

            new IsEqual( message )};
        scmProviderMock
            .expects( new InvokeOnceMatcher() )
            .method( "checkIn" )
            .with( arguments )
            .will( new ReturnStub( new CheckInScmResult( "...", Collections.singletonList( new ScmFile( rootProject
                       .getFile().getPath(), ScmFileStatus.CHECKED_IN ) ) ) ) );

       
       
        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        scmProviderMock
            .expects( new InvokeOnceMatcher() )
            .method( "add" )
            .with( arguments )
            .will( new ReturnStub( new AddScmResult( "...", Collections
                       .singletonList( new ScmFile( Maven.RELEASE_POMv4, ScmFileStatus.ADDED ) ) ) ) );

       
       
        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
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() );

        executor.executeGoals( workingDirectory, "clean integration-test", false, null, new ReleaseResult() );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Mock commandLineMock = createMockCommandLine( workingDirectory, process );
        expectDefaultArguments( commandLineMock );

        String arguments = "-f my-pom.xml";
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "createArgument" ).will(
            new ReturnStub( createArgumentLineMock( arguments ) ) );

        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() );

        executor.executeGoals( workingDirectory, "clean integration-test", false, null, "my-pom.xml",
                               new ReleaseResult() );
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Process process = createMockProcess( 0 );

        Mock commandLineMock = createMockCommandLine( workingDirectory, process );
        String arguments = "-DperformRelease=true -Dmaven.test.skip=true";
        commandLineMock.expects( new InvokeOnceMatcher() ).method( "createArgument" ).will(
            new ReturnStub( createArgumentLineMock( arguments ) ) );

        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() );

        executor.executeGoals( workingDirectory, "clean integration-test", false, arguments, null );
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.