public void afterDelivery() throws ResourceException {
        LOG.trace("Invoking MessageEndpoint.afterDelivery()");
        state.afterDelivery(this);
    }
@Test(timeout = 60000)
    public void testAfterDeliveryFailure() throws Exception {
        setupBeforeDeliverySuccessful();
        setupOnMessageSuccessful();

        context.checking(new Expectations() {{
            oneOf (mockEndpointAndListener).afterDelivery(); will(throwException(new ResourceException()));
        }});

        setupExpectRelease();

        doBeforeDeliveryExpectSuccess();
        doOnMessageExpectSuccess();
        try {
            endpointProxy.afterDelivery();
            fail("An exception should have been thrown");
        } catch (Exception e) {
            assertTrue(true);
        }

        doFullyDeadCheck();
    }