### Question:
KingJoffrey implements EventObserver { @Override public void onEvent(Event e) { LOGGER.info("Received event from the King's Hand: {}", e.toString()); }  @Override void onEvent(Event e);  }### Answer:
@Test public void testOnEvent() { final var kingJoffrey = new KingJoffrey(); IntStream.range(0, Event.values().length).forEach(i -> { assertEquals(i, appender.getLogSize()); var event = Event.values()[i]; kingJoffrey.onEvent(event); final var expectedMessage = "Received event from the King's Hand: " + event.toString(); assertEquals(expectedMessage, appender.getLastMessage()); assertEquals(i + 1, appender.getLogSize()); }); }
@Test public void testOnEvent() { final KingJoffrey kingJoffrey = new KingJoffrey(); for (int i = 0; i < Event.values().length; ++i) { assertEquals(i, appender.getLogSize()); Event event = Event.values()[i]; kingJoffrey.onEvent(event); final String expectedMessage = "Received event from the King's Hand: " + event.toString(); assertEquals(expectedMessage, appender.getLastMessage()); assertEquals(i + 1, appender.getLogSize()); } }