Search in sources :

Example 1 with CaseDefault

use of com.adaptris.core.services.conditional.conditions.CaseDefault in project interlok by adaptris.

the class SwitchTest method testService_Failure.

@Test
public void testService_Failure() throws Exception {
    Switch service = createForTests();
    service.getCases().add(new Case().withCondition(new CaseDefault()).withService(new ThrowExceptionService(new ConfiguredException("always-fail"))));
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    msg.addMetadata("myKey", "17");
    try {
        execute(service, msg);
        fail();
    } catch (ServiceException expected) {
    }
}
Also used : ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) ThrowExceptionService(com.adaptris.core.services.exception.ThrowExceptionService) ConfiguredException(com.adaptris.core.services.exception.ConfiguredException) CaseDefault(com.adaptris.core.services.conditional.conditions.CaseDefault) Test(org.junit.Test)

Aggregations

AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 ServiceException (com.adaptris.core.ServiceException)1 CaseDefault (com.adaptris.core.services.conditional.conditions.CaseDefault)1 ConfiguredException (com.adaptris.core.services.exception.ConfiguredException)1 ThrowExceptionService (com.adaptris.core.services.exception.ThrowExceptionService)1 Test (org.junit.Test)1