diff --git a/src/test/java/org/hisp/dhis/CategoryComboApiTest.java b/src/test/java/org/hisp/dhis/CategoryComboApiTest.java index 1f93d883..4b5498ce 100644 --- a/src/test/java/org/hisp/dhis/CategoryComboApiTest.java +++ b/src/test/java/org/hisp/dhis/CategoryComboApiTest.java @@ -27,6 +27,7 @@ */ package org.hisp.dhis; +import static org.hisp.dhis.support.Assertions.assertNotEmpty; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -62,7 +63,7 @@ void testGetCategoryCombo() { assertFalse(categories.isEmpty()); List categoryOptionCombos = categoryCombo.getCategoryOptionCombos(); - assertFalse(categoryOptionCombos.isEmpty()); + assertNotEmpty(categoryOptionCombos); assertFalse(categoryOptionCombos.get(0).getIgnoreApproval()); assertFalse(categoryOptionCombos.get(0).getCategoryOptions().isEmpty()); } @@ -78,7 +79,23 @@ void testGetCategoryCombos() { CategoryCombo categoryCombo = categoryCombos.get(0); assertNotNull(categoryCombo.getId()); - assertFalse(categoryCombo.getCategories().isEmpty()); - assertFalse(categoryCombo.getCategoryOptionCombos().isEmpty()); + assertNotEmpty(categoryCombo.getCategories()); + assertNotEmpty(categoryCombo.getCategoryOptionCombos()); + } + + @Test + void testGetCategoryCombosExpandAssociations() { + Dhis2 dhis2 = new Dhis2(TestFixture.V42_CONFIG); + + List categoryCombos = + dhis2.getCategoryCombos(Query.instance().withExpandAssociations()); + + assertNotNull(categoryCombos); + assertFalse(categoryCombos.isEmpty()); + + CategoryCombo categoryCombo = categoryCombos.get(0); + assertNotNull(categoryCombo.getId()); + assertNotEmpty(categoryCombo.getCategories()); + assertNotEmpty(categoryCombo.getCategoryOptionCombos()); } } diff --git a/src/test/java/org/hisp/dhis/TestFixture.java b/src/test/java/org/hisp/dhis/TestFixture.java index 5a63ae97..d36c84d0 100644 --- a/src/test/java/org/hisp/dhis/TestFixture.java +++ b/src/test/java/org/hisp/dhis/TestFixture.java @@ -40,14 +40,18 @@ public final class TestFixture { public static final String V41_URL = "https://play.im.dhis2.org/stable-2-41-6"; + public static final String V42_URL = "https://play.im.dhis2.org/stable-2-42-3"; + public static final String LOCAL_URL = "http://localhost/dhis"; public static final String DEFAULT_URL = V41_URL; - public static final Dhis2Config DEFAULT_CONFIG = - new Dhis2Config(DEFAULT_URL, "system", "System123"); - public static final Dhis2Config DEV_CONFIG = new Dhis2Config(DEV_URL, "system", "System123"); + public static final Dhis2Config V42_CONFIG = new Dhis2Config(V42_URL, "system", "System123"); + public static final Dhis2Config LOCAL_CONFIG = new Dhis2Config(LOCAL_URL, "system", "System123"); + + public static final Dhis2Config DEFAULT_CONFIG = + new Dhis2Config(DEFAULT_URL, "system", "System123"); }