← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12895: fix test fail

 

------------------------------------------------------------
revno: 12895
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Thu 2013-11-07 01:33:17 +0700
message:
  fix test fail
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/ActivityReportingServiceTest.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-mobile/src/test/java/org/hisp/dhis/mobile/service/ActivityReportingServiceTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/ActivityReportingServiceTest.java	2013-10-22 04:01:39 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/ActivityReportingServiceTest.java	2013-11-06 18:33:17 +0000
@@ -34,6 +34,8 @@
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
 import org.hisp.dhis.api.mobile.model.PatientAttribute;
 import org.hisp.dhis.api.mobile.model.PatientIdentifier;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -47,16 +49,22 @@
 {
     @Autowired
     private ActivityReportingService activityReportingService;
+    
+    @Autowired
+    private OrganisationUnitService organisationUnitService;
 
     @Test
     public void testSavePatient()
         throws NotAllowedException
     {
+        OrganisationUnit orgUnit = createOrganisationUnit( 'O' );
+        organisationUnitService.addOrganisationUnit( orgUnit );
+        
         Patient patientA = this.createLWUITPatient( 'A' );
         Patient patientB = this.createLWUITPatient( 'B' );
 
-        int patientAId = activityReportingService.savePatient( patientA, 779, "" );
-        int patientBId = activityReportingService.savePatient( patientB, 779, "" );
+        int patientAId = activityReportingService.savePatient( patientA, orgUnit.getId(), "" );
+        int patientBId = activityReportingService.savePatient( patientB, orgUnit.getId(), "" );
 
         patientA = activityReportingService.findPatient( patientAId );
         assertEquals( patientAId, patientA.getId() );