private void initProcessorListener() {
      listener = mock(ProcessorLifecycleListener.class);
      doNothing().when(listener).afterStart();
      doNothing().when(listener).afterFailure(any());
      doAnswer(invocation -> {
        // stopped successfully
        shutdownLatch.countDown();
        return null;
      }).when(listener).afterStop();
    }
A wrapper class to consolidate all the components required to be either mocked or stubbed prior to unit testing
the stream processor.
samza-test/src/test/java/org/apache/samza/test/processor/TestStreamProcessor.java