ThreadExecutor implements Executor { @Override public void execute(final Interactor interactor) { if (interactor == null) { throw new IllegalArgumentException("Interactor to execute can't be null"); } threadPoolExecutor.submit(new Runnable() { @Override public void run() { interactor.operation(); } }); } @Inject  ThreadExecutor(); @Override void execute(final Interactor interactor);  }
@Test public void testSuccessfulInteractorExecution() { Interactor<Void> interactor = mock(Interactor.class); this.executor.execute(interactor); verify(interactor).operation(); }
@Test (expected = IllegalArgumentException.class) public void testNullInteractorExecution() { this.executor.execute(null); }