diff --git a/api/src/main/resources/liquibase.xml b/api/src/main/resources/liquibase.xml
index 8447862..4d6a992 100644
--- a/api/src/main/resources/liquibase.xml
+++ b/api/src/main/resources/liquibase.xml
@@ -347,5 +347,14 @@
+
+
+
+
+
+
+
diff --git a/api/src/test/java/org/openmrs/module/cohort/api/dao/CohortTypeGenericDaoTest.java b/api/src/test/java/org/openmrs/module/cohort/api/dao/CohortTypeGenericDaoTest.java
index 004f937..8975734 100644
--- a/api/src/test/java/org/openmrs/module/cohort/api/dao/CohortTypeGenericDaoTest.java
+++ b/api/src/test/java/org/openmrs/module/cohort/api/dao/CohortTypeGenericDaoTest.java
@@ -13,7 +13,10 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import org.hibernate.exception.ConstraintViolationException;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.api.context.Context;
@@ -24,6 +27,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+
public class CohortTypeGenericDaoTest extends BaseModuleContextSensitiveTest {
private static final String COHORT_TYPE_INITIAL_TEST_DATA_XML = "org/openmrs/module/cohort/api/hibernate/db/CohortTypeDaoTest_initialTestData.xml";
@@ -79,4 +83,21 @@ public void shouldVoidCohortType() {
assertThat(voidedCohortType, nullValue());
}
+ @Test
+ public void shouldPurgeCohortType() {
+ CohortType cohortType = dao.get(COHORT_TYPE_UUID);
+ assertNotNull(cohortType);
+ dao.delete(cohortType);
+ CohortType afterAttemptPurge = dao.get(COHORT_TYPE_UUID);
+ assertNull(afterAttemptPurge);
+ }
+
+ @Test(expected = ConstraintViolationException.class)
+ public void shouldThrowExceptionForPurgeCohortType() {
+ CohortType cohortType = dao.get("94517bf9-d9d6-4726-b4f1-a2dff6b36e2d");
+ assertNotNull(cohortType);
+ dao.delete(cohortType);
+ Context.flushSession();
+ }
+
}
diff --git a/api/src/test/resources/org/openmrs/module/cohort/api/hibernate/db/CohortTypeDaoTest_initialTestData.xml b/api/src/test/resources/org/openmrs/module/cohort/api/hibernate/db/CohortTypeDaoTest_initialTestData.xml
index d771c73..a57715f 100644
--- a/api/src/test/resources/org/openmrs/module/cohort/api/hibernate/db/CohortTypeDaoTest_initialTestData.xml
+++ b/api/src/test/resources/org/openmrs/module/cohort/api/hibernate/db/CohortTypeDaoTest_initialTestData.xml
@@ -9,6 +9,16 @@
graphic logo is a trademark of OpenMRS Inc.
-->
+
+
+
+
+
+