BAEL-639: Fixing failing test

This commit is contained in:
slavisa-baeldung 2017-02-15 10:04:00 +01:00
parent f7ef3766cb
commit 429c700caf
3 changed files with 7 additions and 22 deletions

View File

@ -1,21 +0,0 @@
package org.baeldung.guava;
import com.google.common.eventbus.EventBus;
class EventBusWrapper {
private static EventBus eventBus = new EventBus();
static void register(Object object) {
eventBus.register(object);
}
static void unregister(Object object) {
eventBus.unregister(object);
}
static void post(Object object) {
eventBus.post(object);
}
}

View File

@ -1,5 +1,6 @@
package org.baeldung.guava;
import com.google.common.eventbus.DeadEvent;
import com.google.common.eventbus.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -21,6 +22,12 @@ public class EventListener {
eventsHandled++;
}
@Subscribe
public void handleDeadEvent(DeadEvent deadEvent) {
LOG.info("unhandled event [" + deadEvent.getEvent() + "]");
eventsHandled++;
}
public int getEventsHandled() {
return eventsHandled;
}

View File

@ -48,7 +48,6 @@ public class GuavaEventBusTest {
listener.resetEventsHandled();
eventBus.post(12345);
Thread.sleep(1000);
assertEquals(1, listener.getEventsHandled());
}