dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40915
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20847: minor test addition
------------------------------------------------------------
revno: 20847
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-22 13:03:34 +0700
message:
minor test addition
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/TrackedEntityInstanceServiceTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/TrackedEntityInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/TrackedEntityInstanceServiceTest.java 2015-10-22 05:16:58 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/TrackedEntityInstanceServiceTest.java 2015-10-22 06:03:34 +0000
@@ -28,13 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.HashSet;
-
+import com.google.common.collect.Lists;
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.dxf2.events.trackedentity.TrackedEntityInstance;
@@ -50,6 +44,11 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.HashSet;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -89,7 +88,7 @@
TrackedEntity trackedEntity = createTrackedEntity( 'A' );
trackedEntityService.addTrackedEntity( trackedEntity );
- maleA = createTrackedEntityInstance( 'A', organisationUnitA );
+ maleA = createTrackedEntityInstance( 'A', organisationUnitA );
maleB = createTrackedEntityInstance( 'B', organisationUnitB );
femaleA = createTrackedEntityInstance( 'C', organisationUnitA );
femaleB = createTrackedEntityInstance( 'D', organisationUnitB );
@@ -160,10 +159,19 @@
@Test
public void testDeletePerson()
{
- TrackedEntityInstance trackedEntityInstance = trackedEntityInstanceService.getTrackedEntityInstance( maleA.getUid() );
- trackedEntityInstanceService.deleteTrackedEntityInstance( trackedEntityInstance.getTrackedEntityInstance() );
+ trackedEntityInstanceService.deleteTrackedEntityInstance( maleA.getUid() );
assertNull( trackedEntityInstanceService.getTrackedEntityInstance( maleA.getUid() ) );
assertNotNull( trackedEntityInstanceService.getTrackedEntityInstance( maleB.getUid() ) );
}
+
+ @Test
+ public void testDeleteTrackedEntityInstances()
+ {
+ List<String> uids = Lists.newArrayList( maleA.getUid(), maleB.getUid() );
+ trackedEntityInstanceService.deleteTrackedEntityInstances( uids );
+
+ assertNull( trackedEntityInstanceService.getTrackedEntityInstance( maleA.getUid() ) );
+ assertNull( trackedEntityInstanceService.getTrackedEntityInstance( maleB.getUid() ) );
+ }
}