Package org.jmock

Examples of org.jmock.Sequence


    }

    public void testFailureWithCancelAction() throws Exception {
        // Recovery required after three failures. Only one attempt made after recovery.
        // Use the last failure to cancel the activity, allowing the process to complete.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(4).of(_testService).invoke(); inSequence(seq); will(failTheFirst(4));
            exactly(1).of(_testService).completed(); inSequence(seq);
        }});
View Full Code Here


        context.assertIsSatisfied();
    }

    public void testImmediateFailure() throws Exception {
        // This process does not attempt to retry, entering recovery immediately.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(1).of(_testService).invoke(); inSequence(seq); will(returnValue(false));
            never(_testService).completed(); inSequence(seq);
        }});
View Full Code Here

        context.assertIsSatisfied();
    }

    public void testImmediateFailureAndFault() throws Exception {
        // This process responds to failure with a fault.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(1).of(_testService).invoke(); inSequence(seq); will(returnValue(false));
            never(_testService).completed(); inSequence(seq);
        }});
View Full Code Here

        context.assertIsSatisfied();
    }

    public void testImmediateFailureAndFault2() throws Exception {
        // This process responds to failure with a fault.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(1).of(_testService).invoke(); inSequence(seq); will(returnValue(false));
            never(_testService).completed(); inSequence(seq);
        }});
View Full Code Here

    }

    public void testFailureHandlingInheritence() throws Exception {
        // Since the invocation is repeated 3 times, the process completes after
        // the third (successful) invocation.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(3).of(_testService).invoke(); inSequence(seq); will(failTheFirst(2));
            exactly(1).of(_testService).completed(); inSequence(seq);
        }});
View Full Code Here

    public void testInstanceSummary() throws Exception {
        _processQName = new QName(NAMESPACE, "FailureToRecovery");
        _processId = new QName(NAMESPACE, "FailureToRecovery-1");
        // Failing the first three times and recovering, the process completes.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(4).of(_testService).invoke(); inSequence(seq); will(failTheFirst(3));
            exactly(1).of(_testService).completed(); inSequence(seq);
        }});
View Full Code Here

    public void oneSubscriberReceivesASequnce() {
        // set up
        final ISubscriber subscriber = context.mock(ISubscriber.class);
        instance.add(subscriber);
       
        final Sequence seq = context.sequence("msgseq");
        // double braces again, see
        // http://www.c2.com/cgi/wiki?DoubleBraceInitialization
        final List<String> messages = new ArrayList<String>()
        {{
            add("message1"); add("message2"); add("message3");
View Full Code Here

        verify(startSleepingThreadAndInterrupt().getInterrupters());
    }

    @Test
    public void outputsStackTraceDetails() throws TimeoutException, InterruptedException {
        final Sequence sequence = context.sequence("order");
        context.checking(new Expectations() {{
            oneOf(stream).print(with(containsString("java.lang.Thread.getStackTrace(Thread.java"))); inSequence(sequence);
            oneOf(stream).print(with(containsString("com.google.code.tempusfugit.concurrency.InterruptCapturingThread.interrupt(InterruptCapturingThread.java"))); inSequence(sequence);
            oneOf(stream).print(with(containsString("com.google.code.tempusfugit.concurrency.InterruptCapturingThreadTest.startSleepingThreadAndInterrupt(InterruptCapturingThreadTest"))); inSequence(sequence);
            oneOf(stream).print(with(containsString("com.google.code.tempusfugit.concurrency.InterruptCapturingThreadTest.outputsStackTraceDetails(InterruptCapturingThreadTest.java"))); inSequence(sequence);
View Full Code Here

    @Test
    public void callsResolveOnSetterAndThenObjectChanged() throws Exception {

        mockery.checking(new Expectations() {
            {
                final Sequence sequence = mockery.sequence("set");

                one(mockObjectResolver).resolve(sdo, "name");
                inSequence(sequence);

                one(mockObjectChanger).objectChanged(sdo);
View Full Code Here

    private final Factory<String> factory2 = context.mock(Factory.class, "factory2");
    private final Factory<String> factory3 = context.mock(Factory.class, "factory3");

    @Test
    public void returnsOnSuccessfulDelegateCreate() {
        final Sequence sequence = context.sequence("enumeration");
        context.checking(new Expectations() {{
            oneOf(factory1).create(); will(returnValue("done")); inSequence(sequence);
            never(factory2).create();
            never(factory3).create();
        }});
View Full Code Here

TOP

Related Classes of org.jmock.Sequence

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.