Package org.jmock.api

Examples of org.jmock.api.Action


      }
    };
  }

  private Action checkFolderExists(final String path, final boolean shouldExist) {
    return new Action() {
      public void describeTo(Description desc) {
        desc.appendText("check that folder '" + path + "' " + (shouldExist ? "exists" : "does not exist"));
      }

      public Object invoke(Invocation inv) throws Throwable {
View Full Code Here


      }
    };
  }

  private Action checkDocumentStamp(final String expectedStamp) {
    return new Action() {
      public void describeTo(Description desc) {
        desc.appendText("check that event document is stamped with '" + expectedStamp + "'");
      }

      public Object invoke(Invocation inv) throws Throwable {
View Full Code Here

        context.checking(new Expectations()
        {
            {
                oneOf(eventHandler).onEvent(ringBuffer.get(0), 0L, true);
                inSequence(lifecycleSequence);
                will(new Action()
                {
                    @Override
                    public Object invoke(final Invocation invocation) throws Throwable
                    {
                        throw ex;
View Full Code Here

            throw new UnsupportedOperationException();
        }
    }

    public static Action waitForever() {
        return new Action() {
            public Object invoke(Invocation invocation) throws Throwable {
                Thread.sleep(Integer.MAX_VALUE);
                return null;
            }
View Full Code Here

        context.checking(new Expectations()
        {
            {
                oneOf(batchHandler).onAvailable(ringBuffer.entry(0));
                inSequence(lifecycleSequence);
                will(new Action()
                {
                    @Override
                    public Object invoke(final Invocation invocation) throws Throwable
                    {
                        throw ex;
View Full Code Here

        if(mockContainer == null) {
            mockContainer = getService(DomainObjectContainer.class);
            context.checking(new Expectations() {
                {
                    allowing(mockContainer).newTransientInstance(with(Expectations.<Class<?>>anything()));
                    will(new Action() {
                       
                        @SuppressWarnings("rawtypes")
                        public Object invoke(Invocation invocation) throws Throwable {
                            Class cls = (Class) invocation.getParameter(0);
                            return scenarioExecution.injectServices(cls.newInstance());
View Full Code Here

        }
        service(SimpleObjects.class).create(UUID.randomUUID().toString());
    }
   
    private Action addToInMemoryDB() {
        return new Action() {
           
            @Override
            public Object invoke(Invocation invocation) throws Throwable {
                final InMemoryDB inMemoryDB = getVar("isis", "in-memory-db", InMemoryDB.class);
                final String name = (String)invocation.getParameter(0);
View Full Code Here

            allowing(messageActivationSpec).getEnableBatchBooleanValue(); will (returnValue(Boolean.FALSE));
            allowing(messageActivationSpec).isUseRAManagedTransactionEnabled(); will (returnValue(Boolean.TRUE));
            allowing(messageEndpointFactory).createEndpoint(with (any(XAResource.class))); will (returnValue(messageEndpoint));

            allowing(workManager).scheduleWork((Work) with(anything()), (long) with(any(long.class)), with(any(ExecutionContext.class)), with(any(WorkListener.class)));
            will (new Action() {
                @Override
                public Object invoke(Invocation invocation) throws Throwable {
                    return null;
                }

                @Override
                public void describeTo(Description description) {
                }
            });

            allowing(messageEndpoint).beforeDelivery((Method) with(anything()));
            allowing (messageEndpoint).onMessage(with (any(javax.jms.Message.class))); will(new Action(){
                @Override
                public Object invoke(Invocation invocation) throws Throwable {
                    messageCount.countDown();
                    if (messageCount.getCount() < maxMessages - 11) {
                        TimeUnit.MILLISECONDS.sleep(200);
View Full Code Here

            will(returnValue(0));

            ignoring(testDescriptor);

            one(testExecuterMock).execute(with(sameInstance(test)), with(notNullValue(TestListenerAdapter.class)));
            will(new Action() {
                public void describeTo(Description description) {
                    description.appendText("fail tests");
                }

                public Object invoke(Invocation invocation) throws Throwable {
View Full Code Here

        assertThat(treeWithIncludes.getDisplayName(), equalTo(String.format("directory '%s' include 'a/b', 'c'", tmpDir.getTestDirectory())));
        assertThat(treeWithExcludes.getDisplayName(), equalTo(String.format("directory '%s' exclude 'a/b', 'c'", tmpDir.getTestDirectory())));
    }

    private Action stopVisiting() {
        return new Action() {
            public void describeTo(Description description) {
                description.appendText("stop visiting");
            }

            public Object invoke(Invocation invocation) throws Throwable {
View Full Code Here

TOP

Related Classes of org.jmock.api.Action

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.