### Question:
DefaultEngineController implements EngineController { @Override public void closeSession() { execute(CloseSessionListener.class, CloseSessionListener::onCloseSession, new CloseSessionContext() { }); } DefaultEngineController(Map<Class, Listener> listeners); @Override void closeSession();  }### Answer:
@Test void shouldRegisterListener() { TestListener testListener = new TestListener(); EngineController engineController = EngineControllerFactory.createDefaultFrom(testListener); engineController.closeSession(); assertThat(testListener.isEvaluationTerminated()).isTrue(); }
@Test void shouldRegisterOnlyCloseSessionListener() { TestListener testListener = new TestListener(); UnknownListener unknownListener = new UnknownListener(); EngineController engineController = EngineControllerFactory.createDefaultFrom(unknownListener, testListener, unknownListener); engineController.closeSession(); assertThat(testListener.isEvaluationTerminated()).isTrue(); }