@Test
public void testGetEnabledAlertsForMinute(){

    List<BigInteger> alertsIDList1 = new ArrayList<>();
    alertsIDList1.add(new BigInteger("1"));
    alertsIDList1.add(new BigInteger("2"));
    Map<String, List<BigInteger>> alertMapByCronEntry = new HashMap<>();
    alertMapByCronEntry.put("* * * * *", alertsIDList1);
    alertDefinitionsCache.setAlertsMapByCronEntry(alertMapByCronEntry);
    Map<BigInteger, Alert> alertMapById = new HashMap<>();
    Alert alert1 = new Alert(userService.findAdminUser(), admin, "testAlert1", "COUNT(-1h:scope:metric:avg, -1h:scope:metric:avg, -1h:scope:metric:avg)", "* * * * *");
    alertMapById.put(new BigInteger("1"), alert1);
    Alert alert2 = new Alert(userService.findAdminUser(), admin, "testAlert2", "COUNT(-1h:scope:metric:avg, -1h:scope:metric:avg, -1h:scope:metric:avg)", "* * * * *");
    alertMapById.put(new BigInteger("2"), alert2);
    alertDefinitionsCache.setAlertsMapById(alertMapById);
    Long timeInMillis = new Date().getTime();
    Long flooredMinuteInMillis = timeInMillis - (timeInMillis % MILLISECONDS_PER_MINUTE);
    List<Alert> alerts = alertDefinitionsCache.getEnabledAlertsForMinute(flooredMinuteInMillis);
    assertTrue(alerts.size() == 2);
}