Skip to content

Commit

Permalink
add test method
Browse files Browse the repository at this point in the history
  • Loading branch information
philipparndt committed Jan 31, 2021
1 parent 96c7329 commit a7f9c72
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class Events {
private final static Events events = new Events();
private final Executor executor = Executors.newFixedThreadPool(4);
private final AsyncEventBus eventBus = new AsyncEventBus("mqtt", this.executor);
private AsyncEventBus eventBus = new AsyncEventBus("mqtt", this.executor);

private Events() {

Expand All @@ -19,6 +19,14 @@ public static Events getInstance() {
return events;
}

/**
* Call this method for test purpose only.
* This will create a new event bus and can be used to isolate test cases.
*/
public void resetBus() {
this.eventBus = new AsyncEventBus("mqtt", this.executor);
}

public static void register(final Object object) {
events.eventBus.register(object);
}
Expand Down

0 comments on commit a7f9c72

Please sign in to comment.