@Test public void ensureHealthy_happyDay_whenWithinLimit() throws Exception { final int limit = 10; when(pool.getEvictAfterNumberOfUse()).thenReturn(limit); ensureHealthy_happyDay(limit); // no exception should have thrown }
@Test public void ensureHealthy_chokes_whenOutOfLimit() throws Exception { final int limit = 10; when(pool.getEvictAfterNumberOfUse()).thenReturn(limit); exception.expect(GMServiceException.class); ensureHealthy_happyDay(limit + 1); }
@Test public void ensureHealthy_happyDay_onNoLimit() throws Exception { when(pool.getEvictAfterNumberOfUse()).thenReturn(0); ensureHealthy_happyDay(10); // no exception should have thrown }