Package org.jmock

Examples of org.jmock.Sequence


        assertThat(new CompositeFactory<String>(factory1, factory2, factory3).create(), is("done"));
    }

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


        assertThat(new CompositeFactory<String>(factory1, factory2, factory3).create(), is("done"));
    }

    @Test (expected = FactoryException.class)
    public void throwsExceptionIfAllFactoriesThrowExceptions() {
        final Sequence sequence = context.sequence("enumeration");
        context.checking(new Expectations() {{
            oneOf(factory1).create(); will(throwException(new FactoryException())); inSequence(sequence);
            oneOf(factory2).create(); will(throwException(new FactoryException())); inSequence(sequence);
            oneOf(factory3).create(); will(throwException(new FactoryException())); inSequence(sequence);
        }});
View Full Code Here


    @Test
    public void destroyObjectThenAbort() {
       
        final Sequence tran = context.sequence("tran");
        context.checking(new Expectations() {
            {
                one(mockObjectStore).startTransaction();
                inSequence(tran);
View Full Code Here

    }

    @Test
    public void destroyObject_thenCommit() {

        final Sequence tran = context.sequence("tran");
        context.checking(new Expectations() {
            {
                oneOf(mockObjectStore).startTransaction();
                inSequence(tran);
View Full Code Here

    }

    @Test
    public void makePersistent_happyCase() {

        final Sequence tran = context.sequence("tran");
        context.checking(new Expectations() {
            {
                oneOf(mockObjectStore).startTransaction();
                inSequence(tran);
                oneOf(mockPersistAlgorithm).makePersistent(transientAdapter, persistenceSession);
View Full Code Here

        // setup
        context.ignoring(mockPersistenceSession);

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

                // flushed twice, once before publishing, once after
                exactly(2).of(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
View Full Code Here

        expectingMetaModelToBeInitialized();
        metaModel = new IsisMetaModel(mockRuntimeContext, mockProgrammingModelFacets);
    }

    private void expectingMetaModelToBeInitialized() {
        final Sequence initSequence = context.sequence("init");
        context.checking(new Expectations() {
            {
                allowing(mockRuntimeContext).injectInto(with(any(Object.class)));
                will(IsisActions.injectInto());
               
View Full Code Here

        expectingMetaModelToBeInitialized();
        metaModel = new IsisMetaModel(mockRuntimeContext, mockProgrammingModel);
    }

    private void expectingMetaModelToBeInitialized() {
        final Sequence initSequence = context.sequence("init");
        context.checking(new Expectations() {
            {
                allowing(mockRuntimeContext).injectInto(with(any(Object.class)));
                will(IsisActions.injectInto());
               
View Full Code Here

    public void happyCase() throws Exception {
       
        // given
        final SimpleObject simpleObject = new SimpleObject();
       
        final Sequence seq = context.sequence("create");
        context.checking(new Expectations() {
            {
                oneOf(mockContainer).newTransientInstance(SimpleObject.class);
                inSequence(seq);
                will(returnValue(simpleObject));
View Full Code Here

        final MessageContext context = mockContext.mock(MessageContext.class);
        final HandlersChain chain = mockContext.mock(HandlersChain.class);

        final HttpServletRequestWrapper requestWrapper =
            mockContext.mock(HttpServletRequestWrapper.class);
        final Sequence normalSequence = mockContext.sequence("normalSequence");
        final RequestWrapper wrapper = mockContext.mock(RequestWrapper.class);
        final LoggedServletInputStream inputStream =
            mockContext.mock(LoggedServletInputStream.class);
        final UriInfo uriInfo = mockContext.mock(UriInfo.class);
        final HttpHeaders headers = mockContext.mock(HttpHeaders.class);
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.