Code example for EventBus

0
 
      verify(commandRunner);
 
   } 
 
   EventBus eventBus = new EventBus();
 
   public void testExitStatusZeroReturnsExecResponse() throws InterruptedException, ExecutionException {
      ListeningExecutorService userExecutor = MoreExecutors.sameThreadExecutor();
      Predicate<String> notRunningAnymore = Predicates.alwaysTrue();
      SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction")
               .addMockedMethod("getStatement").addMockedMethod("getNode").addMockedMethod("toString") 
               .createStrictMock(); 
      InitScript initScript = createMockBuilder(InitScript.class).addMockedMethod("getInstanceName").createStrictMock();
 
      expect(commandRunner.runAction("stdout")).andReturn(new ExecResponse("stdout", "", 0));
      expect(commandRunner.runAction("stderr")).andReturn(new ExecResponse("stderr", "", 0));
      expect(commandRunner.runAction("exitstatus")).andReturn(new ExecResponse("444\n", "", 0));
 
      toStringAndEventBusExpectations(commandRunner, initScript);