### Question:
EventManager { public void triggerEvent (EventData event) { if (!event.allowTrigger()) { throw new IllegalStateException("It isn't allowed to trigger this event type!"); } this.handleEvent(event); } EventManager(String name, boolean setAsGlobal); void update(); void update(int maxMillis); void queueEvent(EventData event); void triggerEvent(EventData event); void addListener(int typeID, EventListener<T> listener); void removeListener(int typeID, EventListener<T> listener); static final EventManager getInstance();  }### Answer:
@Test (expected = IllegalStateException.class) public void testTriggerUnsupportedEvent () { EventManager manager = new EventManager("test", false); manager.triggerEvent(new DummyEventDataObject()); }
@Test public void testTriggerEvent () { EventManager manager = new EventManager("test", false); AtomicInteger count = new AtomicInteger(0); EventListener listener = new EventListener() { @Override public void handleEvent(EventData eventData) { count.incrementAndGet(); } }; manager.addListener(2, listener); manager.triggerEvent(new DummyOtherEventDataObject()); assertEquals(1, count.get()); }