@Test public void shouldFailIfLocationIsTooOld() { given(location.getTime()).willReturn(NOW + IsRecentEnoughCriteria.MIN_AGE + 1L); assertThat(recentEnoughCriteria.passes(location, null), is(false)); }
@Test public void shouldFailIfLocationIsNull() { IsRecentEnoughCriteria recentEnoughCriteriaNullLocation = new IsRecentEnoughCriteria(); TestHelper.setField(recentEnoughCriteriaNullLocation, "timeFactory", timeFactory); assertThat(recentEnoughCriteriaNullLocation.passes(null, null), is(false)); }
@Test public void shouldPassIfLocationIsNewEnough() { given(location.getTime()).willReturn(NOW + IsRecentEnoughCriteria.MIN_AGE - 1L); assertThat(recentEnoughCriteria.passes(location, null), is(true)); }