use of de.symeda.sormas.app.util.DiseaseConfigurationCache in project SORMAS-Project by hzi-braunschweig.
the class DiseaseConfigurationDaoTest method testCreateAndUpdate.
@Test
public void testCreateAndUpdate() throws DaoException {
DiseaseConfigurationCache cache = DiseaseConfigurationCache.getInstance();
Disease disease = cache.getAllActiveDiseases().get(0);
DiseaseConfigurationDao dao = DatabaseHelper.getDiseaseConfigurationDao();
DiseaseConfiguration configuration = dao.build();
configuration.setDisease(disease);
// Test create
configuration.setActive(false);
configuration.setFollowUpEnabled(true);
dao.mergeOrCreate(configuration);
cache = DiseaseConfigurationCache.getInstance();
assertFalse(cache.getAllActiveDiseases().contains(disease));
assertTrue(cache.getAllDiseasesWithFollowUp().contains(disease));
// Test update
configuration.setFollowUpEnabled(false);
dao.mergeOrCreate(configuration);
cache = DiseaseConfigurationCache.getInstance();
assertFalse(cache.getAllActiveDiseases().contains(disease));
assertFalse(cache.getAllDiseasesWithFollowUp().contains(disease));
}
Aggregations