← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1463: Fixed a test error. Centralized some test convenience methods.

 

------------------------------------------------------------
revno: 1463
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-02-22 14:47:05 +0100
message:
  Fixed a test error. Centralized some test convenience methods.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationMappingStore.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.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-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationMappingStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationMappingStore.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationMappingStore.java	2010-02-22 13:47:05 +0000
@@ -4,7 +4,6 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataentryform.DataEntryFormStore;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
 
 public interface CaseAggregationMappingStore

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java	2009-10-07 18:39:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java	2010-02-22 13:47:05 +0000
@@ -56,19 +56,6 @@
         patientB = createPatient( 'B' );        
     }
     
-    protected static Patient createPatient( char uniqueChar )
-    {
-        Patient patient = new Patient();
-        
-        patient.setFirstName( "FirstName" + uniqueChar );
-        patient.setMiddleName( "MiddleName" + uniqueChar );
-        patient.setLastName( "LastName" + uniqueChar );
-        patient.setGender( Patient.MALE );
-        patient.setBirthDate( getDate( 1970, 1, 1 ) );
-        
-        return patient;
-    }
-    
     @Test
     public void addGet()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java	2009-11-19 18:43:20 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java	2010-02-22 13:47:05 +0000
@@ -88,19 +88,6 @@
         
         //TODO Add values
     }
-
-    protected static Patient createPatient( char uniqueChar )
-    {
-        Patient patient = new Patient();
-        
-        patient.setFirstName( "FirstName" + uniqueChar );
-        patient.setMiddleName( "MiddleName" + uniqueChar );
-        patient.setLastName( "LastName" + uniqueChar );
-        patient.setGender( Patient.MALE );
-        patient.setBirthDate( getDate( 1970, 1, 1 ) );
-        
-        return patient;
-    }
     
     @Test
     public void addGet()

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java	2009-11-19 18:43:20 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java	2010-02-22 13:47:05 +0000
@@ -92,19 +92,6 @@
         
         categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
     }
-
-    protected static Patient createPatient( char uniqueChar )
-    {
-        Patient patient = new Patient();
-        
-        patient.setFirstName( "FirstName" + uniqueChar );
-        patient.setMiddleName( "MiddleName" + uniqueChar );
-        patient.setLastName( "LastName" + uniqueChar );
-        patient.setGender( Patient.MALE );
-        patient.setBirthDate( getDate( 1970, 1, 1 ) );
-        
-        return patient;
-    }
     
     @Test
     public void aggregate()

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java	2009-11-19 18:43:20 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java	2010-02-22 13:47:05 +0000
@@ -27,6 +27,8 @@
 
 package org.hisp.dhis.program;
 
+import static junit.framework.Assert.assertEquals;
+
 import java.util.HashSet;
 import java.util.Set;
 
@@ -35,8 +37,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.junit.Test;
 
-import static junit.framework.Assert.*;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -69,9 +69,9 @@
         
         organisationUnitService.addOrganisationUnit( organisationUnit );              
         
-        programStageA = createProgramStage( 'A' );       
-        programStageB = createProgramStage( 'B' );
-        programStageC = createProgramStage( 'C' );        
+        programStageA = createProgramStage( 'A', 2, 5 );       
+        programStageB = createProgramStage( 'B', 2, 5 );
+        programStageC = createProgramStage( 'C', 2, 5 );        
 
         programStageService.saveProgramStage( programStageA );
         programStageService.saveProgramStage( programStageB );
@@ -82,29 +82,6 @@
         programStages.add( programStageC );            
     }
     
-    protected static Program createProgram( char uniqueCharacter, Set<ProgramStage> programStages, OrganisationUnit organisationUnit )
-    {
-        Program program = new Program();
-        
-        program.setName( "Program" + uniqueCharacter );
-        program.setDescription( "Description" + uniqueCharacter );
-        program.setProgramStages( programStages );
-        
-        return program;
-    }
-    
-    protected static ProgramStage createProgramStage( char uniqueCharacter )
-    {
-        ProgramStage stage = new ProgramStage();
-        
-        stage.setName( "ProgramStage" + uniqueCharacter );
-        stage.setDescription( "Description" + uniqueCharacter );
-        stage.setStageInProgram( 2 );
-        stage.setMinDaysFromStart( 5 );
-        
-        return stage;
-    }
-    
     @Test
     public void addGet()
     {

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2010-01-20 10:06:43 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2010-02-22 13:47:05 +0000
@@ -75,10 +75,12 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.resourcetable.ResourceTableService;
@@ -837,7 +839,20 @@
         return user;
     }
 
-    public static ProgramStage createProrgamStage( char uniqueCharacter, int stage, int minDays ) //TODO typo
+    protected static Program createProgram( char uniqueCharacter, Set<ProgramStage> programStages, OrganisationUnit organisationUnit )
+    {
+        Program program = new Program();
+        
+        program.setName( "Program" + uniqueCharacter );
+        program.setDescription( "Description" + uniqueCharacter );
+        program.setDateOfEnrollmentDescription( "DateOfEnrollmentDescription" );
+        program.setDateOfIncidentDescription( "DateOfIncidentDescription" );
+        program.setProgramStages( programStages );
+        
+        return program;
+    }
+    
+    public static ProgramStage createProgramStage( char uniqueCharacter, int stage, int minDays )
     {
         ProgramStage programStage = new ProgramStage();
 
@@ -849,6 +864,19 @@
         return programStage;
     }
 
+    public static Patient createPatient( char uniqueChar )
+    {
+        Patient patient = new Patient();
+        
+        patient.setFirstName( "FirstName" + uniqueChar );
+        patient.setMiddleName( "MiddleName" + uniqueChar );
+        patient.setLastName( "LastName" + uniqueChar );
+        patient.setGender( Patient.MALE );
+        patient.setBirthDate( getDate( 1970, 1, 1 ) );
+        
+        return patient;
+    }
+    
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------