private static Logger logger(SubscriberExceptionContext context) { return Logger.getLogger(EventBus.class.getName() + "." + context.getEventBus().identifier()); }
private static Logger logger(SubscriberExceptionContext context) { return Logger.getLogger(EventBus.class.getName() + "." + context.getEventBus().identifier()); }
private static Logger logger(SubscriberExceptionContext context) { return Logger.getLogger(EventBus.class.getName() + "." + context.getEventBus().identifier()); }
public void testSubscriberThrowsException() throws Exception { final RecordingSubscriberExceptionHandler handler = new RecordingSubscriberExceptionHandler(); final EventBus eventBus = new EventBus(handler); final RuntimeException exception = new RuntimeException("but culottes have a tendancy to ride up!"); final Object subscriber = new Object() { @Subscribe public void throwExceptionOn(String message) { throw exception; } }; eventBus.register(subscriber); eventBus.post(EVENT); assertEquals("Cause should be available.", exception, handler.exception); assertEquals("EventBus should be available.", eventBus, handler.context.getEventBus()); assertEquals("Event should be available.", EVENT, handler.context.getEvent()); assertEquals("Subscriber should be available.", subscriber, handler.context.getSubscriber()); assertEquals( "Method should be available.", subscriber.getClass().getMethod("throwExceptionOn", String.class), handler.context.getSubscriberMethod()); }
private static Logger logger(SubscriberExceptionContext context) { return Logger.getLogger(EventBus.class.getName() + "." + context.getEventBus().identifier()); }
private static Logger logger(SubscriberExceptionContext context) { return Logger.getLogger(EventBus.class.getName() + "." + context.getEventBus().identifier()); }
public void testSubscriberThrowsException() throws Exception{ final RecordingSubscriberExceptionHandler handler = new RecordingSubscriberExceptionHandler(); final EventBus eventBus = new EventBus(handler); final RuntimeException exception = new RuntimeException("but culottes have a tendancy to ride up!"); final Object subscriber = new Object() { @Subscribe public void throwExceptionOn(String message) { throw exception; } }; eventBus.register(subscriber); eventBus.post(EVENT); assertEquals("Cause should be available.", exception, handler.exception); assertEquals("EventBus should be available.", eventBus, handler.context.getEventBus()); assertEquals("Event should be available.", EVENT, handler.context.getEvent()); assertEquals("Subscriber should be available.", subscriber, handler.context.getSubscriber()); assertEquals("Method should be available.", subscriber.getClass().getMethod("throwExceptionOn", String.class), handler.context.getSubscriberMethod()); }