CheckExecutor { private void updateFromOverview( Execution execution, JsonNode overview) { listener.onOverview(execution, overview); } @Autowired  CheckExecutor(
            ExecutorEventListener listener,
            ExecutorRestClient restClient,
            ExecutionSource executions); void check(Executor executor);  }
@Test public void updateFromOverview() { ExecutorRestClient client = Mockito.mock(ExecutorRestClient.class); ExecutionSource executions = Mockito.mock(ExecutionSource.class); Executor executor = new Executor(null); executor.setAlive(true); Mockito.when(client.check(executor)).thenReturn("{}"); Execution execution = new Execution(); Mockito.when(executions.getExecution(executor)).thenReturn(execution); ExecutorEventListener listener = Mockito.mock(ExecutorEventListener.class); (new CheckExecutor(listener, client, executions)).check(executor); Mockito.verify(listener, Mockito.times(1)) .onExecutorHasExecution(execution, executor); Mockito.verify(listener, Mockito.times(1)) .onOverview(Mockito.eq(execution), Mockito.any(JsonNode.class)); }