Search in sources :

Example 6 with JsonDataIntegritySummary

use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.

the class DataIntegrityCategoriesControllerTest method testSummaryCategories_no_options.

@Test
void testSummaryCategories_no_options() {
    assertStatus(HttpStatus.CREATED, POST("/categories", "{'name': 'CatDog', 'shortName': 'CD', 'dataDimensionType': 'ATTRIBUTE'}"));
    postSummary("categories-no-options");
    JsonDataIntegritySummary summary = getSummary("categories-no-options");
    assertEquals(1, summary.getCount());
    assertEquals(50, summary.getPercentage().intValue());
}
Also used : JsonDataIntegritySummary(org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary) Test(org.junit.jupiter.api.Test)

Example 7 with JsonDataIntegritySummary

use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.

the class DataIntegrityCategoriesControllerTest method testSummaryCategories_one_default_category.

/**
 * Ideally we would have created a second category named default, but we
 * have made this impossible by unique constraint. So the best we can do is
 * changing the UID of the existing default to some other UID.
 */
@Test
void testSummaryCategories_one_default_category() {
    String uid = CodeGenerator.generateUid();
    assertEquals(uid, updateDefaultCategoryToUid(uid));
    postSummary("categories_one_default_category");
    JsonDataIntegritySummary summary = getSummary("categories_one_default_category");
    assertEquals(1, summary.getCount());
    assertNull(summary.getPercentage());
}
Also used : JsonDataIntegritySummary(org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary) Test(org.junit.jupiter.api.Test)

Example 8 with JsonDataIntegritySummary

use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.

the class DataIntegrityCategoriesControllerTest method testSummaryCategories_one_default_category_combo.

/**
 * Ideally we would have created a second category combo named default, but
 * we have made this impossible by unique constraint. So the best we can do
 * is changing the UID of the existing default to some other UID.
 */
@Test
void testSummaryCategories_one_default_category_combo() {
    String uid = CodeGenerator.generateUid();
    assertEquals(uid, updateDefaultCategoryComboToUid(uid));
    postSummary("categories_one_default_category_combo");
    JsonDataIntegritySummary summary = getSummary("categories_one_default_category_combo");
    assertEquals(1, summary.getCount());
    assertNull(summary.getPercentage());
}
Also used : JsonDataIntegritySummary(org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary) Test(org.junit.jupiter.api.Test)

Aggregations

JsonDataIntegritySummary (org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary)8 Test (org.junit.jupiter.api.Test)7 DataIntegrityCheckType (org.hisp.dhis.dataintegrity.DataIntegrityCheckType)1 JsonObject (org.hisp.dhis.jsontree.JsonObject)1