Search in sources :

Example 1 with DiseaseConfigurationCache

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));
}
Also used : Disease(de.symeda.sormas.api.Disease) DiseaseConfigurationCache(de.symeda.sormas.app.util.DiseaseConfigurationCache) Test(org.junit.Test)

Aggregations

Disease (de.symeda.sormas.api.Disease)1 DiseaseConfigurationCache (de.symeda.sormas.app.util.DiseaseConfigurationCache)1 Test (org.junit.Test)1