TimerFactoryImpl implements TimerFactory { @NotNull @Override public Timer newInstance(@NotNull final TimerCallBack timerCallBack) { return new Timer() { @Override public void run() { timerCallBack.onRun(); } }; } @Inject  TimerFactoryImpl(); @NotNull @Override Timer newInstance(@NotNull final TimerCallBack timerCallBack);  }
@Test public void shouldCheckNewInstanceIsNotNull() { Timer timer = timerFactory.newInstance(timerCallBack); assertThat(timer, notNullValue()); }
@Test public void shouldMakeNewInstance() { Timer timer = timerFactory.newInstance(timerCallBack); timer.run(); verify(timerCallBack).onRun(); }