### Question:
OpenSessionOnDesktopZkListener implements ExecutionInit, DesktopCleanup, ExecutionCleanup { @Override public void init(Execution exec, Execution parent) throws Exception { try { openSessions.openSession(exec.getDesktop().getId()); } catch (Exception e) { logger.warn("Error opening hibernate session", e); throw e; } } OpenSessionOnDesktopZkListener();  OpenSessionOnDesktopZkListener(OpenSessions openSessions); @Override void cleanup(Desktop desktop); @Override void init(Execution exec, Execution parent); @Override void cleanup(Execution exec, Execution parent, List<Throwable> errs);  }### Answer:
@Test(dataProvider = "provideExecutionWithDesktopInside") public void testInit(Execution execution) throws Exception { sut.init(execution, null); verify(openSessions).openSession(execution.getDesktop().getId()); }
@Test(dataProvider = "provideExecutionWithDesktopInside", expectedExceptions = IllegalArgumentException.class) public void cleanUpShouldRethrowSameException(Execution execution) throws Exception { doThrow(new IllegalArgumentException()).when(openSessions).openSession(anyString()); sut.init(execution, null); }