ShowMessageLogic { public boolean shouldShowMessage() { return counterPreferences.getCounter() >= 42; } ShowMessageLogic(final CounterPreferences counterPreferences); boolean shouldShowMessage();  }
@Test public void on42CounterItShouldShowMessage() { counterPreferences.setCounter(42); Assert.assertTrue(showMessageLogic.shouldShowMessage()); }
@Test public void onLessThan42ItShouldNotShowMessage() { counterPreferences.setCounter(41); Assert.assertFalse(showMessageLogic.shouldShowMessage()); }