@Test
  public void testRemoveCurrentDisabled() throws Exception {
    List<AlertCurrentEntity> currentAlerts = m_dao.findCurrent();
    assertNotNull(currentAlerts);
    assertEquals(5, currentAlerts.size());

    AlertDefinitionEntity definition = currentAlerts.get(0).getAlertHistory().getAlertDefinition();
    definition.setEnabled(false);
    m_definitionDao.merge(definition);

    m_dao.removeCurrentDisabledAlerts();

    currentAlerts = m_dao.findCurrent();
    assertEquals(4, currentAlerts.size());
  }
Tests that JPA does the sorting work for us.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java