### Question:
ValidationEventListener { @Subscribe public void onPluginEvent(final ValidationEvent event) { if (events.size() == MAX_ITEMS) { events.poll(); } events.add(event); }  @Subscribe void onPluginEvent(final ValidationEvent event); boolean hasEvents(); int size(); Queue<ValidationEvent> consumeEvents(); static final int MAX_ITEMS; }### Answer:
@Test public void testOnPluginEvent() throws Exception { final int maxItems = ValidationEventListener.MAX_ITEMS + 10; for (int i = 0; i < maxItems; i++) { bus.post(new ValidationEvent(String.valueOf(i))); } Queue<ValidationEvent> pluginEvents = listener.consumeEvents(); assertEquals(ValidationEventListener.MAX_ITEMS, pluginEvents.size()); pluginEvents = listener.consumeEvents(); assertEquals(0, pluginEvents.size()); assertFalse(listener.hasEvents()); assertEquals(0, listener.size()); bus.post(new ValidationEvent("test")); pluginEvents = listener.consumeEvents(); assertEquals(1, pluginEvents.size()); assertEquals(0, listener.size()); pluginEvents = listener.consumeEvents(); assertEquals(0, pluginEvents.size()); assertEquals(0, listener.size()); }