Package org.jmock

Examples of org.jmock.Sequence


        context.assertIsSatisfied();
    }

    public void testShouldConvertEntityWithBadRelationshipToPojo() throws Exception {
        Mockery context = new Mockery();
        final Sequence sequence = context.sequence("sequence");

        final IJDTFacade facade = context.mock(IJDTFacade.class);

        context.checking(new Expectations() {
            {
View Full Code Here


        final List<Method> methods = Arrays.asList(NormalDomainObject.class.getMethod("titleElement1"), NormalDomainObject.class.getMethod("titleElement2"), NormalDomainObject.class.getMethod("titleElement3"));

        final List<TitleComponent> components = Lists.transform(methods, TitleComponent.FROM_METHOD);
        final TitleFacetViaTitleAnnotation facet = new TitleFacetViaTitleAnnotation(components, mockFacetHolder, mockAdapterMap, mockLocalizationProvider);
        final NormalDomainObject normalPojo = new NormalDomainObject();
        final Sequence sequence = context.sequence("in-title-element-order");
        context.checking(new Expectations() {
            {
                allowing(mockObjectAdapter).getObject();
                will(returnValue(normalPojo));
View Full Code Here

        // setup
        ignoreCallsToPersistenceSession();

        mockery.checking(new Expectations() {
            {
                final Sequence transactionOrdering = mockery.sequence("transactionOrdering");
                one(mockObjectStore).startTransaction();
                inSequence(transactionOrdering);

                one(mockObjectStore).endTransaction();
                inSequence(transactionOrdering);
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

        final Event<String> event4 = new EventImpl<String>( 1300, "four" );
        final Event<String> event5 = new EventImpl<String>( 1550, "five" );
        final Event<String> event6 = new EventImpl<String>( 1700, "six" );
       
        // define a jmock sequence and state machine
        final Sequence seq = context.sequence( "call sequence" );
        final States ts = context.states( "timestamp" ).startsAs( String.valueOf( event1.getTimestamp() ) );
       
        // create mock objects for the source and the receiver
        final EventSource source = context.mock( EventSource.class );
        final EventReceiver receiver = context.mock( EventReceiver.class );
View Full Code Here

        final Event<String> event4 = new EventImpl<String>( startTime + 1300, "four" );
        final Event<String> event5 = new EventImpl<String>( startTime + 1550, "five" );
        final Event<String> event6 = new EventImpl<String>( startTime + 1700, "six" );
       
        // define a jmock sequence and state machine
        final Sequence seq = context.sequence( "call sequence" );
       
        // create mock objects for the source and the receiver
        final EventSource source = context.mock( EventSource.class );
        final EventReceiver receiver = context.mock( EventReceiver.class );
       
View Full Code Here

        public void completed();
    }

    public void testInvokeSucceeds() throws Exception {
        // Since the service invocation succeeds, the process completes.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(1).of(_testService).invoke(); inSequence(seq); will(returnValue(true));
            exactly(1).of(_testService).completed(); inSequence(seq);
        }});
View Full Code Here

    }

    public void testFailureWithRecoveryAfterRetry() 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 testFailureWithManualRecovery() throws Exception {
        // Recovery required after three failures. Only one attempt made after recovery.
        // Only the fifth invocation succeeds.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(5).of(_testService).invoke(); inSequence(seq); will(failTheFirst(4));
            exactly(1).of(_testService).completed(); inSequence(seq);
        }});
View Full Code Here

    }

    public void testFailureWithFaultAction() throws Exception {
        // Recovery required after three failures. Only one attempt made after recovery.
        // Use the last failure to cause a fault.
        final Sequence seq = context.sequence("sequence");
        context.checking(new Expectations() {{
            exactly(4).of(_testService).invoke(); inSequence(seq); will(failTheFirst(4));
            never(_testService).completed(); inSequence(seq);
        }});
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.