Examples of ThrowStub


Examples of org.jmock.core.stub.ThrowStub

    {
        MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.ROLE, "test-map-development-versions" );

        Mock mockPrompter = new Mock( Prompter.class );
        mockPrompter.expects( new InvokeOnceMatcher() ).method( "prompt" ).will(
            new ThrowStub( new PrompterException( "..." ) ) );
        phase.setPrompter( (Prompter) mockPrompter.proxy() );

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

        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();

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

            fail( "Expected an exception" );
        }
        catch ( ReleaseExecutionException e )
        {
            assertEquals( "check cause", PrompterException.class, e.getCause().getClass() );
        }

        releaseDescriptor = new ReleaseDescriptor();

        mockPrompter.reset();
        mockPrompter.expects( new InvokeOnceMatcher() ).method( "prompt" ).will(
            new ThrowStub( new PrompterException( "..." ) ) );

        try
        {
            phase.simulate( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

        Mock mock = new Mock( MavenExecutor.class );
        Constraint[] constraints = new Constraint[]{new IsEqual( testFile ), new IsEqual( "clean integration-test" ),
            new IsAnything(), new IsEqual( Boolean.TRUE ), new IsNull(), new IsAnything()};
        mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints ).will(
            new ThrowStub( new MavenExecutorException( "...", new Exception() ) ) );

        phase.setMavenExecutor( (MavenExecutor) mock.proxy() );

        try
        {
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

        Mock mock = new Mock( MavenExecutor.class );
        Constraint[] constraints = new Constraint[]{new IsEqual( testFile ), new IsEqual( "clean integration-test" ),
            new IsAnything(), new IsEqual( Boolean.TRUE ), new IsNull(), new IsAnything()};
        mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints ).will(
            new ThrowStub( new MavenExecutorException( "...", new Exception() ) ) );

        phase.setMavenExecutor(ReleaseEnvironment.DEFAULT_MAVEN_EXECUTOR_ID, (MavenExecutor) mock.proxy() );

        try
        {
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

            new IsInstanceOf( ReleaseEnvironment.class ),
            new IsNull()
        };

        mock.expects( new InvokeOnceMatcher() ).method( "perform" ).with( constraints ).will(
            new ThrowStub( new ReleaseExecutionException( "..." ) ) );
        mojo.setReleaseManager( (ReleaseManager) mock.proxy() );

        try
        {
            mojo.execute();
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

            new IsNull()
        };

        ReleaseFailureException cause = new ReleaseFailureException( "..." );
        mock.expects( new InvokeOnceMatcher() ).method( "perform" ).with( constraints ).will(
            new ThrowStub( cause ) );
        mojo.setReleaseManager( (ReleaseManager) mock.proxy() );

        try
        {
            mojo.execute();
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

            new IsEqual( Boolean.TRUE ),
            new IsEqual( Boolean.FALSE )
        };

        mock.expects( new InvokeOnceMatcher() ).method( "prepare" ).with( constraints ).will(
            new ThrowStub( new ReleaseExecutionException( "..." ) ) );
        mojo.setReleaseManager( (ReleaseManager) mock.proxy() );

        try
        {
            mojo.execute();
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

            new IsEqual( Boolean.FALSE )
        };

        ReleaseFailureException cause = new ReleaseFailureException( "..." );
        mock.expects( new InvokeOnceMatcher() ).method( "prepare" ).with( constraints ).will(
            new ThrowStub( cause ) );
        mojo.setReleaseManager( (ReleaseManager) mock.proxy() );

        try
        {
            mojo.execute();
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

    public void testPrompterException()
        throws Exception
    {
        Mock mockPrompter = new Mock( Prompter.class );
        mockPrompter.expects( new InvokeOnceMatcher() ).method( "prompt" ).will(
            new ThrowStub( new PrompterException( "..." ) ) );
        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" );

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

            fail( "Expected an exception" );
        }
        catch ( ReleaseExecutionException e )
        {
            assertEquals( "check cause", PrompterException.class, e.getCause().getClass() );
        }

        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" ).will(
            new ThrowStub( new PrompterException( "..." ) ) );

        try
        {
            phase.simulate( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

        config.setScmUseEditMode( true );
        mapNextVersion( config, "groupId:artifactId" );

        Mock scmProviderMock = new Mock( ScmProvider.class );
        scmProviderMock.expects( new InvokeAtLeastOnceMatcher() ).method( "edit" ).will(
            new ThrowStub( new ScmException( "..." ) ) );

        ScmManagerStub scmManager = new ScmManagerStub();
        DefaultScmRepositoryConfigurator configurator =
            (DefaultScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.ROLE );
        configurator.setScmManager( scmManager );
View Full Code Here

Examples of org.jmock.core.stub.ThrowStub

        List<MavenProject> reactorProjects = createReactorProjects();
        ReleaseDescriptor releaseDescriptor = createReleaseDescriptor();

        Mock scmManagerMock = new Mock( ScmManager.class );
        scmManagerMock.expects( new InvokeOnceMatcher() ).method( "makeScmRepository" ).with( new IsEqual(
            "scm-url" ) ).will( new ThrowStub( new NoSuchScmProviderException( "..." ) ) );

        ScmManager scmManager = (ScmManager) scmManagerMock.proxy();
        DefaultScmRepositoryConfigurator configurator = (DefaultScmRepositoryConfigurator) lookup(
            ScmRepositoryConfigurator.ROLE );
        configurator.setScmManager( scmManager );
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.