use of com.adaptris.core.event.AdapterStartEvent in project interlok by adaptris.
the class AdapterTest method testAdapterStartThrowsException.
@Test
public void testAdapterStartThrowsException() throws Exception {
MockMessageProducer mockEventProducer = new MockMessageProducer();
Adapter a = createAdapter("testAdapterStartThrowsException", new DefaultEventHandler(mockEventProducer));
a.getChannelList().add(new Channel() {
@Override
public void start() throws CoreException {
super.start();
throw new CoreException();
}
});
a.requestInit();
try {
a.requestStart();
fail();
} catch (CoreException e) {
}
waitForMessages(mockEventProducer, 3);
assertEquals(3, mockEventProducer.messageCount());
Event event = EventFactory.createEvent(mockEventProducer.getMessages().get(2));
assertEquals(AdapterStartEvent.class, event.getClass());
assertEquals(false, ((AdapterStartEvent) event).getWasSuccessful());
a.requestClose();
}
Aggregations