Package org.jmock.core.constraint

Examples of org.jmock.core.constraint.IsEqual


    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


    }

    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();
    }
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();
    }
View Full Code Here

        ReleaseDescriptor config = new ReleaseDescriptor();
        config.setCompletionGoals( "clean integration-test" );
        config.setWorkingDirectory( testFile.getAbsolutePath() );

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

        phase.setMavenExecutor(ReleaseEnvironment.DEFAULT_MAVEN_EXECUTOR_ID, (MavenExecutor) mock.proxy() );
View Full Code Here

        ReleaseDescriptor config = new ReleaseDescriptor();
        config.setCompletionGoals( "clean integration-test" );
        config.setWorkingDirectory( testFile.getAbsolutePath() );

        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 IsAnything(), new IsAnything()};
        mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );

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

        phase.simulate( config, new DefaultReleaseEnvironment(), null );
View Full Code Here

        ReleaseDescriptor config = new ReleaseDescriptor();
        config.setCompletionGoals( "clean integration-test" );
        config.setWorkingDirectory( testFile.getAbsolutePath() );

        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() );
View Full Code Here

        ReleaseDescriptor config = new ReleaseDescriptor();
        config.setCompletionGoals( "clean integration-test" );
        config.setWorkingDirectory( testFile.getAbsolutePath() );

        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() );
View Full Code Here

*/
public class CreateSessionInterceptorTest extends StrutsInternalTestCase {

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.FALSE));
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.FALSE));
        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

*/
public class CreateSessionInterceptorTest extends StrutsTestCase {

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

*/
public class CreateSessionInterceptorTest extends StrutsTestCase {

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

TOP

Related Classes of org.jmock.core.constraint.IsEqual

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.