MetaCacheCheck extends AbstractIntervalCheck { @Override protected void doCheck() { if (isMetaCacheOverDue()) { alertManager.alert(null, ALERT_TYPE.META_CACHE_BLOCKED, "meta-cache-not-update-for-long-time"); } }    }
@Test public void doCheck() { doNothing().when(alertManager).alert(any(), any(), any()); when(metaCache.getLastUpdateTime()).thenReturn(System.currentTimeMillis()); metaCacheCheck.doCheck(); verify(alertManager, never()).alert(any(), any(), any()); }
@Test public void doCheckWithAlert() { doNothing().when(alertManager).alert(any(), any(), any()); when(metaCache.getLastUpdateTime()).thenReturn(System.currentTimeMillis() - 15 * 1000); metaCacheCheck.doCheck(); verify(alertManager, times(1)).alert(any(), any(), any()); }