Lynx { public void startReading() { logcat.setListener(new Logcat.Listener() { @Override public void onTraceRead(String logcatTrace) { try { addTraceToTheBuffer(logcatTrace); } catch (IllegalTraceException e) { return; } notifyNewTraces(); } }); boolean logcatWasNotStarted = Thread.State.NEW.equals(logcat.getState()); if (logcatWasNotStarted) { logcat.start(); } } Lynx(Logcat logcat, MainThread mainThread, TimeProvider timeProvider); synchronized void setConfig(LynxConfig lynxConfig); LynxConfig getConfig(); void startReading(); void stopReading(); synchronized void restart(); synchronized void registerListener(Listener lynxPresenter); synchronized void unregisterListener(Listener lynxPresenter);  }
@Test public void shouldRegisterListenerOnStart() { lynx.startReading(); verify(logcat).setListener(any(Logcat.Listener.class)); }
@Test public void shouldStartLogcatOnStart() { givenLogcatHasBeenCreatedButNotStarted(); lynx.startReading(); verify(logcat).start(); }