Package com.volantis.testtools.mock

Examples of com.volantis.testtools.mock.TestEvent


        // It should be partially satisfied without any events.
        repeating.verify();

        // It should be able to process the single event.
        repeating.checkExpectations(ExpectationState.CURRENT, new TestEvent("A"), report);

        // It should be completely satisfied now.
        assertTrue("Not completely satisfied",
                   repeating.isCompletelySatisfied(ExpectationState.CURRENT));
    }
View Full Code Here


        // It should be partially satisfied without any events.
        repeating.verify();

        // See what effect processing the event will have.
        EventEffect effect = repeating.checkExpectations(
                ExpectationState.CURRENT, new TestEvent("B"), report);
        assertSame("Event does not satisfy expectation",
                   EventEffect.WOULD_SATISFY, effect);
    }
View Full Code Here

        }

        // Try and process a number of events.
        for (int i = 0; i < 5; i += 1) {
            // It should be able to process the single event.
            repeating.checkExpectations(ExpectationState.CURRENT, new TestEvent("A"), report);

            // Now it should be partially satisfied.
            repeating.verify();
        }
View Full Code Here

        }

        // Try and process the correct number of events.
        for (int i = 0; i < 3; i += 1) {
            // It should be able to process the single event.
            repeating.checkExpectations(ExpectationState.CURRENT, new TestEvent("A"), report);
        }

        // It should be completely satisfied now.
        assertTrue("Not completely satisfied",
                   repeating.isCompletelySatisfied(ExpectationState.CURRENT));
View Full Code Here

        Expectation nested = new TestSimpleExpectation("A");
        RepeatingExpectation repeating
                = new RepeatingExpectation(1, 2, nested);

        // Process and event to move it into a partially satisfied state.
        repeating.checkExpectations(ExpectationState.CURRENT, new TestEvent("A"), report);

        // Make sure that it is only partially satisfied.
        repeating.verify();
        assertFalse("Completely satisfied", repeating.isCompletelySatisfied(ExpectationState.CURRENT));

        // The unhandled event should cause the repeating expectation to be
        // satisfied but not consume the event.
        EventEffect effect = repeating.checkExpectations(
                ExpectationState.CURRENT, new TestEvent("B"), report);
        assertSame("Event does not satisfy expectation",
                   EventEffect.WOULD_SATISFY, effect);
    }
View Full Code Here

        Expectation nested = new TestSimpleExpectation("A");
        RepeatingExpectation repeating
                = new RepeatingExpectation(2, 3, nested);

        // Process and event to move it towards a partially satisfied state.
        repeating.checkExpectations(ExpectationState.CURRENT, new TestEvent("A"), report);

        // Make sure that it is not partially satisfied.
        assertFalse("Partially satisfied", repeating.isSatisfied(report));

        // The unhandled event should cause the repeating expectation to fail.
        EventEffect effect = repeating.checkExpectations(
                ExpectationState.CURRENT, new TestEvent("B"), report);

        assertSame("Event does not fail expectation",
                   EventEffect.WOULD_FAIL, effect);
    }
View Full Code Here

                0, 1, new TestSimpleExpectation("A"));
        RepeatingExpectation repeating
                = new RepeatingExpectation(1, 2, nested);

        // Process and event to move it into a partially satisfied state.
        repeating.checkExpectations(ExpectationState.CURRENT, new TestEvent("A"), report);

        // Make sure that it is only partially satisfied.
        repeating.verify();
        assertFalse("Completely satisfied", repeating.isCompletelySatisfied(ExpectationState.CURRENT));

        // The unhandled event should cause the repeating expectation to be
        // satisfied but not consume the event.
        EventEffect effect = repeating.checkExpectations(
                ExpectationState.CURRENT, new TestEvent("B"), report);
        assertSame("Event does not satisfy expectation",
                   EventEffect.WOULD_SATISFY, effect);
    }
View Full Code Here

                0, 1, new TestSimpleExpectation("A"));
        RepeatingExpectation repeating
                = new RepeatingExpectation(20, 300, nested);

        // Process and event to move it towards a partially satisfied state.
        repeating.checkExpectations(ExpectationState.CURRENT, new TestEvent("A"), report);

        // Make sure that it is not partially satisfied.
        try {
            repeating.verify();
            fail("Partially satisfied");
        } catch (AssertionFailedError e) {
            // Worked.
        }

        // The unhandled event should cause the repeating expectation to be
        // satisfied but not consume the event.
        EventEffect effect = repeating.checkExpectations(
                ExpectationState.CURRENT, new TestEvent("B"), report);
        assertSame("Event does not satisfy expectation",
                   EventEffect.WOULD_SATISFY, effect);
    }
View Full Code Here

        }

        // The unhandled event should cause the repeating expectation to be
        // satisfied but not consume the event.
        EventEffect effect = repeating.checkExpectations(
                ExpectationState.CURRENT, new TestEvent("B"), report);
        assertSame("Event does not satisfy expectation",
                   EventEffect.WOULD_SATISFY, effect);
    }
View Full Code Here

        return sequence;
    }

    protected List createSatisfyingEvents() {
        List list = new ArrayList();
        list.add(new TestEvent("A"));
        list.add(new TestEvent("B"));
        list.add(new TestEvent("C"));
        return list;
    }
View Full Code Here

TOP

Related Classes of com.volantis.testtools.mock.TestEvent

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.