Package com.volantis.testtools.mock

Examples of com.volantis.testtools.mock.ExpectationBuilder


     */
    public void testDetectKnownThreadClash() throws Exception {

        PerThreadExpectationBuilder builder =
                mockFactory.createPerThreadBuilder();
        ExpectationBuilder builder1 = mockFactory.createOrderedBuilder();
        ExpectationBuilder builder2 = mockFactory.createUnorderedBuilder();

        ThreadMatcher matcher1 =
                mockFactory.createKnownThreadMatcher("matcher 1");
        ThreadMatcher matcher2 =
                mockFactory.createKnownThreadMatcher("matcher 2");
View Full Code Here


     * Check that foo is being used properly.
     * @param user
     */
    protected void checkFooUsage(FooUser user) {

        ExpectationBuilder expectations = mockFactory.createOrderedBuilder();

        // Create the mock object.
        FooMock foo = new FooMock(expectations);

        // Set the expectation.
View Full Code Here

        // =====================================================================
        //   Create Mocks
        // =====================================================================

        // Create a sequence of shared expectations.
        ExpectationBuilder expects = mockFactory.createOrderedBuilder();

        final ExpectedValue EXPECTS_INSTANCE_OF_REPORT =
                mockFactory.expectsInstanceOf(Report.class);

        final InternalExpectationMock expectationMock =
View Full Code Here

        // =====================================================================
        //   Create Mocks
        // =====================================================================

        // Create a sequence of shared expectations.
        ExpectationBuilder expectations = mockFactory.createOrderedBuilder();

        final ExpectedValue EXPECTS_INSTANCE_OF_REPORT =
                mockFactory.expectsInstanceOf(Report.class);

        final InternalExpectationMock expectation1Mock =
View Full Code Here

    }


    public Occurrences add(ThreadMatcher matcher, Expectations expectations) {

        ExpectationBuilder builder = null;
        synchronized (this) {
            for (int i = 0; i < outstandingBindings.size(); i++) {
                ThreadBinder binder = (ThreadBinder) outstandingBindings.get(i);
                if (binder.matcher == matcher) {
                    builder = binder.builder;
                }
            }
        }
        if (builder == null) {
            throw new IllegalStateException(
                    "Could not find builder that is bound to " + matcher);
        }

        ExpectationBuilder oldBuilder = currentBuilder;
        this.currentBuilder = builder;
        try {
            return super.add(expectations);
        } finally {
            this.currentBuilder = oldBuilder;
View Full Code Here

            this.currentBuilder = oldBuilder;
        }
    }

    public void add(Expectation expectation) {
        ExpectationBuilder builder = currentBuilder;
        if (builder == null) {
            builder = getThreadSpecificBuilder();
        }

        builder.add(expectation);
    }
View Full Code Here

    private synchronized ExpectationBuilder getThreadSpecificBuilder() {
        Thread thread = Thread.currentThread();

        // Check to see if the thread has already been bound.
        ExpectationBuilder builder =
                (ExpectationBuilder) boundThreads2Builder.get(thread);
        if (builder != null) {
            return builder;
        }
View Full Code Here

     * Test that we can use the builder to create a vaid resource migrator,
     * exercising as many of the builder methods as possible.
     */
    public void testSuccess() {
        //todo: use common properties and methods as per testAddSimpleXSLStep(), etc?
        ExpectationBuilder expectations = mockFactory.createOrderedBuilder();

        // ==================================================================
        // Create mocks.
        // ==================================================================

View Full Code Here

        TestMenuModuleCustomisation customisation
                = new TestMenuModuleCustomisation();

        // Create a mock OutputBufferResolver that expects to be called lots of
        // times with the same value.
        ExpectationBuilder expectations = mockFactory.createOrderedBuilder();
        final OutputBufferResolverMock resolverMock =
                new OutputBufferResolverMock("resolverMock", expectations);
        CompositeExpectedValue expectedArgument =
            MockFactory.getDefaultInstance().expectsAnyDefined();
        expectedArgument.addExpectedValue(mockFactory.expectsNull());
View Full Code Here

            throws MessageException, IOException, RecipientException {

        testSimulator.start(listener);

        // Create test objects.
        ExpectationBuilder orderedExpectations =
                mockFactory.createOrderedBuilder();
        HashMap channelInfo = createChannelInfoMap();
        channelInfo.put(LogicaSMSChannelAdapter.BINDTYPE, SYNC_BINDTYPE);
        SessionPoolMock sessionPool =
                new SessionPoolMock("sessionPool", orderedExpectations);
View Full Code Here

TOP

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

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.