← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12921: Move test classes in tracker to right packages.

 

------------------------------------------------------------
revno: 12921
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-12 13:40:55 +0700
message:
  Move test classes in tracker to right packages.
removed:
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueStoreTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientcomment/
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientcomment/PatientCommentServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueStoreTest.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportService.java
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/patientreport/DefaultPatientAggregateReportService.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.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/patientreport/PatientAggregateReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportService.java	2013-11-04 03:13:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportService.java	2013-11-12 06:40:55 +0000
@@ -47,7 +47,7 @@
      * @return A generated unique id of the added {@link PatientAggregateReport}
      *         .
      */
-    void addPatientAggregateReport( PatientAggregateReport patientAggregateReport );
+    int addPatientAggregateReport( PatientAggregateReport patientAggregateReport );
 
     /**
      * Updates an {@link PatientAggregateReport}.

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/patientreport/DefaultPatientAggregateReportService.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/patientreport/DefaultPatientAggregateReportService.java	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/patientreport/DefaultPatientAggregateReportService.java	2013-11-12 06:40:55 +0000
@@ -50,9 +50,9 @@
     }
 
     @Override
-    public void addPatientAggregateReport( PatientAggregateReport patientAggregateReport )
+    public int addPatientAggregateReport( PatientAggregateReport patientAggregateReport )
     {
-        patientAggregateReportStore.save( patientAggregateReport );
+        return patientAggregateReportStore.save( patientAggregateReport );
     }
 
     @Override

=== removed directory 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue'
=== removed file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueServiceTest.java	2013-11-12 04:21:08 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueServiceTest.java	1970-01-01 00:00:00 +0000
@@ -1,400 +0,0 @@
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.patient.patientattributevalue;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientAttributeOption;
-import org.hisp.dhis.patient.PatientAttributeOptionService;
-import org.hisp.dhis.patient.PatientAttributeService;
-import org.hisp.dhis.patient.PatientService;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version $ PatientAttributeValueServiceTest.java Nov 11, 2013 9:45:10 AM $
- */
-public class PatientAttributeValueServiceTest
-    extends DhisSpringTest
-{
-
-    @Autowired
-    private PatientAttributeValueService attributeValueService;
-
-    @Autowired
-    private PatientService patientService;
-
-    @Autowired
-    private OrganisationUnitService organisationUnitService;
-
-    @Autowired
-    private PatientAttributeService attributeService;
-
-    @Autowired
-    private PatientAttributeOptionService attributeOptionService;
-
-    private PatientAttribute attributeA;
-
-    private PatientAttribute attributeB;
-
-    private PatientAttribute attributeC;
-
-    private PatientAttributeOption attributeOpionA;
-
-    private PatientAttributeOption attributeOpionB;
-
-    private Patient patientA;
-
-    private Patient patientB;
-
-    private Patient patientC;
-
-    private Patient patientD;
-
-    private int patientAId;
-
-    private int patientBId;
-
-    private PatientAttributeValue attributeValueA;
-
-    private PatientAttributeValue attributeValueB;
-
-    private PatientAttributeValue attributeValueC;
-
-    private PatientAttributeValue attributeValueD;
-
-    private PatientAttributeValue attributeValueE;
-
-    @Override
-    public void setUpTest()
-    {
-        OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
-        organisationUnitService.addOrganisationUnit( organisationUnit );
-
-        patientA = createPatient( 'A', organisationUnit );
-        patientB = createPatient( 'B', organisationUnit );
-        patientC = createPatient( 'C', organisationUnit );
-        patientD = createPatient( 'D', organisationUnit );
-
-        patientAId = patientService.savePatient( patientA );
-        patientBId = patientService.savePatient( patientB );
-        patientService.savePatient( patientC );
-        patientService.savePatient( patientD );
-
-        attributeA = createPatientAttribute( 'A' );
-        attributeB = createPatientAttribute( 'B' );
-        attributeC = createPatientAttribute( 'C' );
-
-        attributeService.savePatientAttribute( attributeA );
-        attributeService.savePatientAttribute( attributeB );
-        attributeService.savePatientAttribute( attributeC );
-
-        attributeOpionA = createPatientAttributeOption( 'A', attributeC );
-        attributeOpionB = createPatientAttributeOption( 'B', attributeC );
-
-        attributeOptionService.addPatientAttributeOption( attributeOpionA );
-        attributeOptionService.addPatientAttributeOption( attributeOpionB );
-
-        attributeValueA = new PatientAttributeValue( attributeA, patientA, "A" );
-        attributeValueB = new PatientAttributeValue( attributeB, patientA, "B" );
-        attributeValueC = new PatientAttributeValue( attributeA, patientB, "C" );
-        attributeValueD = new PatientAttributeValue( attributeC, patientC, "AttributeOptionA" );
-        attributeValueD.setPatientAttributeOption( attributeOpionA );
-        attributeValueE = new PatientAttributeValue( attributeC, patientD, "AttributeOptionB" );
-        attributeValueE.setPatientAttributeOption( attributeOpionB );
-    }
-
-    @Test
-    public void testSavePatientAttributeValue()
-    {
-
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-    }
-
-    @Test
-    public void testUpdatePatientAttributeValue()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-
-        attributeValueA.setValue( "B" );
-        attributeValueService.updatePatientAttributeValue( attributeValueA );
-
-        assertEquals( "B", attributeValueService.getPatientAttributeValue( patientA, attributeA ).getValue() );
-    }
-
-    @Test
-    public void testDeletePatientAttributeValue()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-
-        attributeValueService.deletePatientAttributeValue( attributeValueA );
-
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-
-        attributeValueService.deletePatientAttributeValue( attributeValueB );
-
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-    }
-
-    @Test
-    public void testDeletePatientAttributeValueByPatient()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientB, attributeA ) );
-
-        attributeValueService.deletePatientAttributeValue( patientA );
-
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientB, attributeA ) );
-
-        attributeValueService.deletePatientAttributeValue( patientB );
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-        assertNull( attributeValueService.getPatientAttributeValue( patientB, attributeA ) );
-    }
-
-    @Test
-    public void testDeletePatientAttributeValueByAttribute()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientB, attributeA ) );
-
-        attributeValueService.deletePatientAttributeValue( attributeA );
-
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNull( attributeValueService.getPatientAttributeValue( patientB, attributeA ) );
-        assertNotNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-
-        attributeValueService.deletePatientAttributeValue( attributeB );
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertNull( attributeValueService.getPatientAttributeValue( patientA, attributeB ) );
-        assertNull( attributeValueService.getPatientAttributeValue( patientB, attributeA ) );
-
-    }
-
-    @Test
-    public void testGetPatientAttributeValue()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        assertEquals( attributeValueA, attributeValueService.getPatientAttributeValue( patientA, attributeA ) );
-        assertEquals( attributeValueC, attributeValueService.getPatientAttributeValue( patientB, attributeA ) );
-    }
-
-    @Test
-    public void testGetPatientAttributeValuesByPatient()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueService.getPatientAttributeValues( patientA );
-
-        assertEquals( 2, attributeValues.size() );
-        assertTrue( equals( attributeValues, attributeValueA, attributeValueB ) );
-
-        attributeValues = attributeValueService.getPatientAttributeValues( patientB );
-
-        assertEquals( 1, attributeValues.size() );
-        assertTrue( equals( attributeValues, attributeValueC ) );
-    }
-
-    @Test
-    public void testGetPatientAttributeValuesbyAttribute()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueService
-            .getPatientAttributeValues( attributeA );
-        assertEquals( 2, attributeValues.size() );
-        assertTrue( attributeValues.contains( attributeValueA ) );
-        assertTrue( attributeValues.contains( attributeValueC ) );
-
-        attributeValues = attributeValueService.getPatientAttributeValues( attributeB );
-        assertEquals( 1, attributeValues.size() );
-        assertTrue( attributeValues.contains( attributeValueB ) );
-    }
-
-    @Test
-    public void testGetPatientAttributeValuesbyPatientList()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        Collection<Patient> patients = new HashSet<Patient>();
-        patients.add( patientA );
-        patients.add( patientB );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueService.getPatientAttributeValues( patients );
-        assertEquals( 3, attributeValues.size() );
-        assertTrue( equals( attributeValues, attributeValueA, attributeValueB, attributeValueC ) );
-    }
-
-    @Test
-    public void testGetAllPatientAttributeValues()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        assertTrue( equals( attributeValueService.getAllPatientAttributeValues(), attributeValueA, attributeValueB,
-            attributeValueC ) );
-    }
-
-    @Test
-    public void testGetPatientAttributeValueMapForPatients()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        Collection<Patient> patients = new HashSet<Patient>();
-        patients.add( patientA );
-        patients.add( patientB );
-
-        Map<Integer, Collection<PatientAttributeValue>> attributeValueMap = attributeValueService
-            .getPatientAttributeValueMapForPatients( patients );
-
-        assertEquals( 2, attributeValueMap.keySet().size() );
-        assertTrue( equals( attributeValueMap.get( patientAId ), attributeValueA, attributeValueB ) );
-        assertTrue( equals( attributeValueMap.get( patientBId ), attributeValueC ) );
-    }
-
-    @Test
-    public void testGetPatientAttributeValueMapForPatientsAttributes()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        Collection<Patient> patients = new HashSet<Patient>();
-        patients.add( patientA );
-        patients.add( patientB );
-
-        Map<Integer, PatientAttributeValue> attributeValueMap = attributeValueService
-            .getPatientAttributeValueMapForPatients( patients, attributeA );
-
-        assertEquals( 2, attributeValueMap.keySet().size() );
-        assertEquals( attributeValueA, attributeValueMap.get( patientAId ) );
-        assertEquals( attributeValueC, attributeValueMap.get( patientBId ) );
-    }
-
-    @Test
-    public void testSearchPatientAttributeValue()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueService.searchPatientAttributeValue(
-            attributeA, "A" );
-        assertTrue( equals( attributeValues, attributeValueA ) );
-    }
-
-    @Test
-    public void testCopyPatientAttributeValues()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        attributeValueService.copyPatientAttributeValues( patientA, patientB );
-
-        PatientAttributeValue attributeValue = attributeValueService.getPatientAttributeValue( patientB, attributeB );
-        assertEquals( "B", attributeValue.getValue() );
-
-        attributeValue = attributeValueService.getPatientAttributeValue( patientB, attributeA );
-        assertNull( attributeValue );
-    }
-
-    @Test
-    public void testGetPatients()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueB );
-        attributeValueService.savePatientAttributeValue( attributeValueC );
-
-        Collection<Patient> patients = attributeValueService.getPatient( attributeA, "A" );
-        assertEquals( 1, patients.size() );
-        assertTrue( patients.contains( patientA ) );
-    }
-
-    @Test
-    public void testCountByPatientAttributeoption()
-    {
-        attributeValueService.savePatientAttributeValue( attributeValueA );
-        attributeValueService.savePatientAttributeValue( attributeValueD );
-        attributeValueService.savePatientAttributeValue( attributeValueE );
-
-        int count = attributeValueService.countByPatientAttributeoption( attributeOpionA );
-        assertEquals( 1, count );
-    }
-
-}

=== removed file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueStoreTest.java	2013-11-12 04:21:08 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientattributevalue/PatientAttributeValueStoreTest.java	1970-01-01 00:00:00 +0000
@@ -1,295 +0,0 @@
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.patient.patientattributevalue;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientAttributeOption;
-import org.hisp.dhis.patient.PatientAttributeOptionService;
-import org.hisp.dhis.patient.PatientAttributeService;
-import org.hisp.dhis.patient.PatientService;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValueStore;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version $ PatientattributeValueStoreTest.java Nov 11, 2013 9:45:10 AM $
- */
-public class PatientAttributeValueStoreTest
-    extends DhisSpringTest
-{
-
-    @Autowired
-    private PatientAttributeValueStore attributeValueStore;
-
-    @Autowired
-    private PatientService patientService;
-
-    @Autowired
-    private OrganisationUnitService organisationUnitService;
-
-    @Autowired
-    private PatientAttributeService attributeService;
-
-    @Autowired
-    private PatientAttributeOptionService attributeOptionService;
-
-    private PatientAttribute attributeA;
-
-    private PatientAttribute attributeB;
-
-    private PatientAttribute attributeC;
-
-    private PatientAttributeOption attributeOpionA;
-
-    private PatientAttributeOption attributeOpionB;
-
-    private Patient patientA;
-
-    private Patient patientB;
-
-    private Patient patientC;
-
-    private Patient patientD;
-
-    private PatientAttributeValue attributeValueA;
-
-    private PatientAttributeValue attributeValueB;
-
-    private PatientAttributeValue attributeValueC;
-
-    private PatientAttributeValue attributeValueD;
-
-    private PatientAttributeValue attributeValueE;
-
-    @Override
-    public void setUpTest()
-    {
-        OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
-        organisationUnitService.addOrganisationUnit( organisationUnit );
-
-        patientA = createPatient( 'A', organisationUnit );
-        patientB = createPatient( 'B', organisationUnit );
-        patientC = createPatient( 'C', organisationUnit );
-        patientD = createPatient( 'D', organisationUnit );
-
-        patientService.savePatient( patientA );
-        patientService.savePatient( patientB );
-        patientService.savePatient( patientC );
-        patientService.savePatient( patientD );
-
-        attributeA = createPatientAttribute( 'A' );
-        attributeB = createPatientAttribute( 'B' );
-        attributeC = createPatientAttribute( 'C' );
-
-        attributeService.savePatientAttribute( attributeA );
-        attributeService.savePatientAttribute( attributeB );
-        attributeService.savePatientAttribute( attributeC );
-
-        attributeOpionA = createPatientAttributeOption( 'A', attributeC );
-        attributeOpionB = createPatientAttributeOption( 'B', attributeC );
-
-        attributeOptionService.addPatientAttributeOption( attributeOpionA );
-        attributeOptionService.addPatientAttributeOption( attributeOpionB );
-
-        attributeValueA = new PatientAttributeValue( attributeA, patientA, "A" );
-        attributeValueB = new PatientAttributeValue( attributeB, patientA, "B" );
-        attributeValueC = new PatientAttributeValue( attributeA, patientB, "C" );
-        attributeValueD = new PatientAttributeValue( attributeC, patientC, "AttributeOptionA" );
-        attributeValueD.setPatientAttributeOption( attributeOpionA );
-        attributeValueE = new PatientAttributeValue( attributeC, patientD, "AttributeOptionB" );
-        attributeValueE.setPatientAttributeOption( attributeOpionB );
-    }
-
-    @Test
-    public void testSavePatientAttributeValue()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-
-        assertNotNull( attributeValueStore.get( patientA, attributeA ) );
-        assertNotNull( attributeValueStore.get( patientA, attributeA ) );
-    }
-
-    @Test
-    public void testDeletePatientAttributeValueByPatient()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        assertNotNull( attributeValueStore.get( patientA, attributeA ) );
-        assertNotNull( attributeValueStore.get( patientA, attributeB ) );
-        assertNotNull( attributeValueStore.get( patientB, attributeA ) );
-
-        attributeValueStore.deleteByPatient( patientA );
-
-        assertNull( attributeValueStore.get( patientA, attributeA ) );
-        assertNull( attributeValueStore.get( patientA, attributeB ) );
-        assertNotNull( attributeValueStore.get( patientB, attributeA ) );
-
-        attributeValueStore.deleteByPatient( patientB );
-        assertNull( attributeValueStore.get( patientA, attributeA ) );
-        assertNull( attributeValueStore.get( patientA, attributeB ) );
-        assertNull( attributeValueStore.get( patientB, attributeA ) );
-    }
-
-    @Test
-    public void testDeleteByAttribute()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        assertNotNull( attributeValueStore.get( patientA, attributeA ) );
-        assertNotNull( attributeValueStore.get( patientA, attributeB ) );
-        assertNotNull( attributeValueStore.get( patientB, attributeA ) );
-
-        attributeValueStore.deleteByAttribute( attributeA );
-
-        assertNull( attributeValueStore.get( patientA, attributeA ) );
-        assertNull( attributeValueStore.get( patientB, attributeA ) );
-        assertNotNull( attributeValueStore.get( patientA, attributeB ) );
-
-        attributeValueStore.deleteByAttribute( attributeB );
-        assertNull( attributeValueStore.get( patientA, attributeA ) );
-        assertNull( attributeValueStore.get( patientA, attributeB ) );
-        assertNull( attributeValueStore.get( patientB, attributeA ) );
-
-    }
-
-    @Test
-    public void testGetPatientAttributeValue()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        assertEquals( attributeValueA, attributeValueStore.get( patientA, attributeA ) );
-        assertEquals( attributeValueC, attributeValueStore.get( patientB, attributeA ) );
-    }
-
-    @Test
-    public void testGetByPatient()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueStore.get( patientA );
-
-        assertEquals( 2, attributeValues.size() );
-        assertTrue( equals( attributeValues, attributeValueA, attributeValueB ) );
-
-        attributeValues = attributeValueStore.get( patientB );
-
-        assertEquals( 1, attributeValues.size() );
-        assertTrue( equals( attributeValues, attributeValueC ) );
-    }
-
-    @Test
-    public void testGetPatientAttributeValuesbyAttribute()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueStore.get( attributeA );
-        assertEquals( 2, attributeValues.size() );
-        assertTrue( attributeValues.contains( attributeValueA ) );
-        assertTrue( attributeValues.contains( attributeValueC ) );
-
-        attributeValues = attributeValueStore.get( attributeB );
-        assertEquals( 1, attributeValues.size() );
-        assertTrue( attributeValues.contains( attributeValueB ) );
-    }
-
-    @Test
-    public void testGetPatientAttributeValuesbyPatientList()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        Collection<Patient> patients = new HashSet<Patient>();
-        patients.add( patientA );
-        patients.add( patientB );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueStore.get( patients );
-        assertEquals( 3, attributeValues.size() );
-        assertTrue( equals( attributeValues, attributeValueA, attributeValueB, attributeValueC ) );
-    }
-
-    @Test
-    public void testSearchPatientAttributeValue()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        Collection<PatientAttributeValue> attributeValues = attributeValueStore.searchByValue( attributeA, "A" );
-        assertTrue( equals( attributeValues, attributeValueA ) );
-    }
-
-    @Test
-    public void testGetPatients()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        Collection<Patient> patients = attributeValueStore.getPatient( attributeA, "A" );
-        assertEquals( 1, patients.size() );
-        assertTrue( patients.contains( patientA ) );
-    }
-
-    @Test
-    public void testCountByPatientAttributeoption()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueD );
-        attributeValueStore.saveVoid( attributeValueE );
-
-        int count = attributeValueStore.countByPatientAttributeoption( attributeOpionA );
-        assertEquals( 1, count );
-    }
-
-}

=== removed directory 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientcomment'
=== removed file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientcomment/PatientCommentServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientcomment/PatientCommentServiceTest.java	2013-11-11 08:04:38 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientcomment/PatientCommentServiceTest.java	1970-01-01 00:00:00 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.patient.patientcomment;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.patientcomment.PatientComment;
-import org.hisp.dhis.patientcomment.PatientCommentService;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version $ PatientCommentService.java Nov 5, 2013 3:11:48 PM $
- */
-public class PatientCommentServiceTest
-    extends DhisSpringTest
-{
-    @Autowired
-    private PatientCommentService patientCommentService;
-
-    private PatientComment patientCommentA;
-
-    private PatientComment patientCommentB;
-
-    @Override
-    public void setUpTest()
-    {
-        patientCommentA = new PatientComment( "A", "Test", new Date() );
-        patientCommentB = new PatientComment( "B", "Test", new Date() );
-    }
-
-    @Test
-    public void testSavePatientComment()
-    {
-        int idA = patientCommentService.addPatientComment( patientCommentA );
-        int idB = patientCommentService.addPatientComment( patientCommentB );
-
-        assertNotNull( patientCommentService.getPatientComment( idA ) );
-        assertNotNull( patientCommentService.getPatientComment( idB ) );
-    }
-
-    @Test
-    public void testDeletePatientComment()
-    {
-        int idA = patientCommentService.addPatientComment( patientCommentA );
-        int idB = patientCommentService.addPatientComment( patientCommentB );
-
-        assertNotNull( patientCommentService.getPatientComment( idA ) );
-        assertNotNull( patientCommentService.getPatientComment( idB ) );
-
-        patientCommentService.deletePatientComment( patientCommentA );
-
-        assertNull( patientCommentService.getPatientComment( idA ) );
-        assertNotNull( patientCommentService.getPatientComment( idB ) );
-
-        patientCommentService.deletePatientComment( patientCommentB );
-
-        assertNull( patientCommentService.getPatientComment( idA ) );
-        assertNull( patientCommentService.getPatientComment( idB ) );
-    }
-
-    @Test
-    public void testUpdatePatientComment()
-    {
-        int idA = patientCommentService.addPatientComment( patientCommentA );
-
-        assertNotNull( patientCommentService.getPatientComment( idA ) );
-
-        patientCommentA.setCommentText( "B" );
-        patientCommentService.updatePatientComment( patientCommentA );
-
-        assertEquals( "B", patientCommentService.getPatientComment( idA ).getCommentText());
-    }
-
-    @Test
-    public void testGetPatientCommentById()
-    {
-        int idA = patientCommentService.addPatientComment( patientCommentA );
-        int idB = patientCommentService.addPatientComment( patientCommentB );
-
-        assertEquals( patientCommentA, patientCommentService.getPatientComment( idA ) );
-        assertEquals( patientCommentB, patientCommentService.getPatientComment( idB ) );
-    }
-
-
-    @Test
-    public void testGetAllPatientComments()
-    {
-        patientCommentService.addPatientComment( patientCommentA );
-        patientCommentService.addPatientComment( patientCommentB );
-
-        assertTrue( equals( patientCommentService.getAllPatientComments(), patientCommentA, patientCommentB ) );
-    }
-
-}

=== removed directory 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue'
=== removed file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueServiceTest.java	2013-11-12 04:21:08 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueServiceTest.java	1970-01-01 00:00:00 +0000
@@ -1,349 +0,0 @@
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.patient.patientdatavalue;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patient.PatientService;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.patientdatavalue.PatientDataValueService;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramInstanceService;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.program.ProgramStageService;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version $ PatientDataValueServiceTest.java Nov 5, 2013 3:11:48 PM $
- */
-public class PatientDataValueServiceTest
-    extends DhisSpringTest
-{
-    @Autowired
-    private PatientDataValueService patientDataValueService;
-
-    @Autowired
-    private PatientService patientService;
-
-    @Autowired
-    private ProgramService programService;
-
-    @Autowired
-    private ProgramStageService programStageService;
-
-    @Autowired
-    private ProgramInstanceService programInstanceService;
-
-    @Autowired
-    private ProgramStageInstanceService programStageInstanceService;
-
-    @Autowired
-    private OrganisationUnitService organisationUnitService;
-
-    @Autowired
-    private DataElementService dataElementService;
-
-    private ProgramInstance programInstance;
-
-    private ProgramStageInstance stageInstanceA;
-
-    private ProgramStageInstance stageInstanceB;
-
-    private DataElement dataElementA;
-
-    private DataElement dataElementB;
-
-    private PatientDataValue dataValueA;
-
-    private PatientDataValue dataValueB;
-
-    private PatientDataValue dataValueC;
-
-    private PatientDataValue dataValueD;
-
-    private Date yesterday;
-
-    private Date tomorrow;
-
-    private Patient patient;
-
-    @Override
-    public void setUpTest()
-    {
-        OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
-        organisationUnitService.addOrganisationUnit( organisationUnit );
-
-        dataElementA = createDataElement( 'A' );
-        dataElementB = createDataElement( 'B' );
-
-        dataElementService.addDataElement( dataElementA );
-        dataElementService.addDataElement( dataElementB );
-
-        patient = createPatient( 'A', organisationUnit );
-        patientService.savePatient( patient );
-
-        Program program = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
-        programService.addProgram( program );
-
-        ProgramStage stageA = new ProgramStage( "A", program );
-        programStageService.saveProgramStage( stageA );
-
-        ProgramStage stageB = new ProgramStage( "B", program );
-        programStageService.saveProgramStage( stageB );
-
-        Set<ProgramStage> programStages = new HashSet<ProgramStage>();
-        programStages.add( stageA );
-        programStages.add( stageB );
-        program.setProgramStages( programStages );
-        programService.updateProgram( program );
-
-        Calendar calYesterday = Calendar.getInstance();
-        calYesterday.add( Calendar.DATE, -1 );
-        yesterday = calYesterday.getTime();
-        Calendar calTomorrow = Calendar.getInstance();
-        calTomorrow.add( Calendar.DATE, 1 );
-        tomorrow = calTomorrow.getTime();
-
-        programInstance = programInstanceService.enrollPatient( patient, program, yesterday, yesterday,
-            organisationUnit, null );
-
-        stageInstanceA = programStageInstanceService.getProgramStageInstance( programInstance, stageA );
-        stageInstanceB = programStageInstanceService.getProgramStageInstance( programInstance, stageB );
-
-        dataValueA = new PatientDataValue( stageInstanceA, dataElementA, "A" );
-        dataValueB = new PatientDataValue( stageInstanceA, dataElementB, "B" );
-        dataValueC = new PatientDataValue( stageInstanceB, dataElementA, "C" );
-        dataValueD = new PatientDataValue( stageInstanceB, dataElementB, "D" );
-    }
-
-    @Test
-    public void testSavePatientDataValue()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementB ) );
-    }
-
-    @Test
-    public void testDeletePatientDataValue()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementB ) );
-
-        patientDataValueService.deletePatientDataValue( dataValueA );
-
-        assertNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementB ) );
-
-        patientDataValueService.deletePatientDataValue( dataValueB );
-
-        assertNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ) );
-        assertNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementB ) );
-    }
-
-    @Test
-    public void testUpdatePatientDataValue()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ) );
-
-        dataValueA.setValue( "B" );
-        patientDataValueService.updatePatientDataValue( dataValueA );
-
-        assertEquals( "B", patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ).getValue() );
-    }
-
-    @Test
-    public void testDeletePatientDataValueByStageInstance()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-        patientDataValueService.savePatientDataValue( dataValueC );
-        patientDataValueService.savePatientDataValue( dataValueD );
-
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementB ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceB, dataElementA ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceB, dataElementB ) );
-
-        patientDataValueService.deletePatientDataValue( stageInstanceA );
-        assertNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA ) );
-        assertNull( patientDataValueService.getPatientDataValue( stageInstanceA, dataElementB ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceB, dataElementA ) );
-        assertNotNull( patientDataValueService.getPatientDataValue( stageInstanceB, dataElementB ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByStageInstance()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-        patientDataValueService.savePatientDataValue( dataValueC );
-        patientDataValueService.savePatientDataValue( dataValueD );
-
-        Collection<PatientDataValue> dataValues = patientDataValueService.getPatientDataValues( stageInstanceA );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-
-        dataValues = patientDataValueService.getPatientDataValues( stageInstanceB );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueC ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByStageElement()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-        patientDataValueService.savePatientDataValue( dataValueC );
-        patientDataValueService.savePatientDataValue( dataValueD );
-
-        Collection<DataElement> dataElements = new HashSet<DataElement>();
-        dataElements.add( dataElementA );
-        dataElements.add( dataElementB );
-
-        Collection<PatientDataValue> dataValues = patientDataValueService.getPatientDataValues( stageInstanceA,
-            dataElements );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-    }
-
-    @Test
-    public void testGetPatientDataValues()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-        patientDataValueService.savePatientDataValue( dataValueC );
-        patientDataValueService.savePatientDataValue( dataValueD );
-
-        Collection<ProgramStageInstance> programStageInstances = new HashSet<ProgramStageInstance>();
-        programStageInstances.add( stageInstanceA );
-        programStageInstances.add( stageInstanceB );
-
-        Collection<PatientDataValue> dataValues = patientDataValueService.getPatientDataValues( programStageInstances );
-        assertEquals( 4, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-        assertTrue( dataValues.contains( dataValueC ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByDataElement()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-        patientDataValueService.savePatientDataValue( dataValueC );
-        patientDataValueService.savePatientDataValue( dataValueD );
-
-        Collection<PatientDataValue> dataValues = patientDataValueService.getPatientDataValues( dataElementA );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueC ) );
-
-        dataValues = patientDataValueService.getPatientDataValues( dataElementB );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueB ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByPatientDataElement()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-        patientDataValueService.savePatientDataValue( dataValueC );
-        patientDataValueService.savePatientDataValue( dataValueD );
-
-        Collection<DataElement> dataElements = new HashSet<DataElement>();
-        dataElements.add( dataElementA );
-        dataElements.add( dataElementB );
-
-        Collection<PatientDataValue> dataValues = patientDataValueService.getPatientDataValues( patient, dataElements,
-            yesterday, tomorrow );
-
-        dataValues = patientDataValueService.getPatientDataValues( dataElementB );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueB ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValue()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueB );
-
-        PatientDataValue dataValue = patientDataValueService.getPatientDataValue( stageInstanceA, dataElementA );
-        assertEquals( dataValueA, dataValue );
-
-        dataValue = patientDataValueService.getPatientDataValue( stageInstanceA, dataElementB );
-        assertEquals( dataValueB, dataValue );
-    }
-
-    @Test
-    public void testGetAllPatientDataValues()
-    {
-        patientDataValueService.savePatientDataValue( dataValueA );
-        patientDataValueService.savePatientDataValue( dataValueA );
-
-        assertTrue( equals( patientDataValueService.getAllPatientDataValues(), dataValueA, dataValueA ) );
-    }
-
-}

=== removed file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueStoreTest.java	2013-11-12 04:21:08 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/patientdatavalue/PatientDataValueStoreTest.java	1970-01-01 00:00:00 +0000
@@ -1,308 +0,0 @@
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.patient.patientdatavalue;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patient.PatientService;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.patientdatavalue.PatientDataValueStore;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramInstanceService;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.program.ProgramStageService;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version $ PatientDataValueServiceTest.java Nov 5, 2013 3:11:48 PM $
- */
-public class PatientDataValueStoreTest
-    extends DhisSpringTest
-{
-    @Autowired
-    private PatientDataValueStore patientDataValueStore;
-
-    @Autowired
-    private PatientService patientService;
-
-    @Autowired
-    private ProgramService programService;
-
-    @Autowired
-    private ProgramStageService programStageService;
-
-    @Autowired
-    private ProgramInstanceService programInstanceService;
-
-    @Autowired
-    private ProgramStageInstanceService programStageInstanceService;
-
-    @Autowired
-    private OrganisationUnitService organisationUnitService;
-
-    @Autowired
-    private DataElementService dataElementService;
-
-    private ProgramInstance programInstance;
-
-    private ProgramStageInstance stageInstanceA;
-
-    private ProgramStageInstance stageInstanceB;
-
-    private DataElement dataElementA;
-
-    private DataElement dataElementB;
-
-    private PatientDataValue dataValueA;
-
-    private PatientDataValue dataValueB;
-
-    private PatientDataValue dataValueC;
-
-    private PatientDataValue dataValueD;
-
-    private Date yesterday;
-
-    private Date tomorrow;
-
-    private Patient patient;
-
-    @Override
-    public void setUpTest()
-    {
-        OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
-        organisationUnitService.addOrganisationUnit( organisationUnit );
-
-        dataElementA = createDataElement( 'A' );
-        dataElementB = createDataElement( 'B' );
-
-        dataElementService.addDataElement( dataElementA );
-        dataElementService.addDataElement( dataElementB );
-
-        patient = createPatient( 'A', organisationUnit );
-        patientService.savePatient( patient );
-
-        Program program = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
-        programService.addProgram( program );
-
-        ProgramStage stageA = new ProgramStage( "A", program );
-        programStageService.saveProgramStage( stageA );
-
-        ProgramStage stageB = new ProgramStage( "B", program );
-        programStageService.saveProgramStage( stageB );
-
-        Set<ProgramStage> programStages = new HashSet<ProgramStage>();
-        programStages.add( stageA );
-        programStages.add( stageB );
-        program.setProgramStages( programStages );
-        programService.updateProgram( program );
-
-        Calendar calYesterday = Calendar.getInstance();
-        calYesterday.add( Calendar.DATE, -1 );
-        yesterday = calYesterday.getTime();
-        Calendar calTomorrow = Calendar.getInstance();
-        calTomorrow.add( Calendar.DATE, 1 );
-        tomorrow = calTomorrow.getTime();
-
-        programInstance = programInstanceService.enrollPatient( patient, program, yesterday, yesterday,
-            organisationUnit, null );
-
-        stageInstanceA = programStageInstanceService.getProgramStageInstance( programInstance, stageA );
-        stageInstanceB = programStageInstanceService.getProgramStageInstance( programInstance, stageB );
-
-        dataValueA = new PatientDataValue( stageInstanceA, dataElementA, "A" );
-        dataValueB = new PatientDataValue( stageInstanceA, dataElementB, "B" );
-        dataValueC = new PatientDataValue( stageInstanceB, dataElementA, "C" );
-        dataValueD = new PatientDataValue( stageInstanceB, dataElementB, "D" );
-    }
-
-    @Test
-    public void testSavePatientDataValue()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-
-        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementA ) );
-        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementB ) );
-    }
-
-
-    @Test
-    public void testDeletePatientDataValueByStageInstance()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-        patientDataValueStore.saveVoid( dataValueC );
-        patientDataValueStore.saveVoid( dataValueD );
-
-        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementA ) );
-        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementB ) );
-        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementA ) );
-        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementB ) );
-
-        patientDataValueStore.delete( stageInstanceA );
-        assertNull( patientDataValueStore.get( stageInstanceA, dataElementA ) );
-        assertNull( patientDataValueStore.get( stageInstanceA, dataElementB ) );
-        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementA ) );
-        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementB ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByStageInstance()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-        patientDataValueStore.saveVoid( dataValueC );
-        patientDataValueStore.saveVoid( dataValueD );
-
-        Collection<PatientDataValue> dataValues = patientDataValueStore.get( stageInstanceA );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-
-        dataValues = patientDataValueStore.get( stageInstanceB );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueC ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByStageElement()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-        patientDataValueStore.saveVoid( dataValueC );
-        patientDataValueStore.saveVoid( dataValueD );
-
-        Collection<DataElement> dataElements = new HashSet<DataElement>();
-        dataElements.add( dataElementA );
-        dataElements.add( dataElementB );
-
-        Collection<PatientDataValue> dataValues = patientDataValueStore.get( stageInstanceA,
-            dataElements );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-    }
-
-    @Test
-    public void testGetPatientDataValues()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-        patientDataValueStore.saveVoid( dataValueC );
-        patientDataValueStore.saveVoid( dataValueD );
-
-        Collection<ProgramStageInstance> programStageInstances = new HashSet<ProgramStageInstance>();
-        programStageInstances.add( stageInstanceA );
-        programStageInstances.add( stageInstanceB );
-
-        Collection<PatientDataValue> dataValues = patientDataValueStore.get( programStageInstances );
-        assertEquals( 4, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-        assertTrue( dataValues.contains( dataValueC ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByDataElement()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-        patientDataValueStore.saveVoid( dataValueC );
-        patientDataValueStore.saveVoid( dataValueD );
-
-        Collection<PatientDataValue> dataValues = patientDataValueStore.get( dataElementA );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueC ) );
-
-        dataValues = patientDataValueStore.get( dataElementB );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueB ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValuesByPatientDataElement()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-        patientDataValueStore.saveVoid( dataValueC );
-        patientDataValueStore.saveVoid( dataValueD );
-
-        Collection<DataElement> dataElements = new HashSet<DataElement>();
-        dataElements.add( dataElementA );
-        dataElements.add( dataElementB );
-
-        Collection<PatientDataValue> dataValues = patientDataValueStore.get( patient, dataElements,
-            yesterday, tomorrow );
-
-        dataValues = patientDataValueStore.get( dataElementB );
-        assertEquals( 2, dataValues.size() );
-        assertTrue( dataValues.contains( dataValueB ) );
-        assertTrue( dataValues.contains( dataValueD ) );
-    }
-
-    @Test
-    public void testGetPatientDataValue()
-    {
-        patientDataValueStore.saveVoid( dataValueA );
-        patientDataValueStore.saveVoid( dataValueB );
-
-        PatientDataValue dataValue = patientDataValueStore.get( stageInstanceA, dataElementA );
-        assertEquals( dataValueA, dataValue );
-
-        dataValue = patientDataValueStore.get( stageInstanceA, dataElementB );
-        assertEquals( dataValueB, dataValue );
-    }
-
-}

=== 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	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java	2013-11-12 06:40:55 +0000
@@ -1,20 +1,17 @@
-package org.hisp.dhis.patientdatavalue;
-
 /*
  * Copyright (c) 2004-2013, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -28,75 +25,284 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+package org.hisp.dhis.patientdatavalue;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueStore;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageService;
 import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
- * @author Lars Helge Overland
- * @version $Id$
+ * @author Chau Thu Tran
+ * 
+ * @version $ PatientDataValueServiceTest.java Nov 5, 2013 3:11:48 PM $
  */
-@SuppressWarnings( "unused" )
 public class PatientDataValueStoreTest
     extends DhisSpringTest
 {
+    @Autowired
     private PatientDataValueStore patientDataValueStore;
-    
+
+    @Autowired
     private PatientService patientService;
-    
+
+    @Autowired
+    private ProgramService programService;
+
+    @Autowired
+    private ProgramStageService programStageService;
+
+    @Autowired
+    private ProgramInstanceService programInstanceService;
+
+    @Autowired
+    private ProgramStageInstanceService programStageInstanceService;
+
+    @Autowired
+    private OrganisationUnitService organisationUnitService;
+
+    @Autowired
+    private DataElementService dataElementService;
+
+    private ProgramInstance programInstance;
+
+    private ProgramStageInstance stageInstanceA;
+
+    private ProgramStageInstance stageInstanceB;
+
     private DataElement dataElementA;
+
     private DataElement dataElementB;
-    
-    private Patient patientA;
-    private Patient patientB;
-        
-    private PatientDataValue valueA;
-    private PatientDataValue valueB;
-    private PatientDataValue valueC;    
-    private PatientDataValue valueD;  
-    
-    private OrganisationUnit organisationUnit;
-    
+
+    private PatientDataValue dataValueA;
+
+    private PatientDataValue dataValueB;
+
+    private PatientDataValue dataValueC;
+
+    private PatientDataValue dataValueD;
+
+    private Date yesterday;
+
+    private Date tomorrow;
+
+    private Patient patient;
+
     @Override
     public void setUpTest()
     {
-        patientDataValueStore = (PatientDataValueStore) getBean( PatientDataValueStore.ID );
-        
-        dataElementService = (DataElementService) getBean( DataElementService.ID );
-        
-        categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-        
-        patientService = (PatientService) getBean( PatientService.ID );
-        
-        organisationUnitService = (OrganisationUnitService) getBean ( OrganisationUnitService.ID );
-        
+        OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
+        organisationUnitService.addOrganisationUnit( organisationUnit );
+
         dataElementA = createDataElement( 'A' );
         dataElementB = createDataElement( 'B' );
-        
+
         dataElementService.addDataElement( dataElementA );
         dataElementService.addDataElement( dataElementB );
-        
-        organisationUnit = createOrganisationUnit( 'A' );
-        organisationUnitService.addOrganisationUnit( organisationUnit );
-        
-        patientA = createPatient( 'A', organisationUnit );
-        patientB = createPatient( 'B', organisationUnit );
-        
-        patientService.savePatient( patientA );
-        patientService.savePatient( patientB );
-                
-        //TODO Add values
-    }
-    
-    @Test
-    public void addGet()
-    {        
-        //TODO Test get
-    }
+
+        patient = createPatient( 'A', organisationUnit );
+        patientService.savePatient( patient );
+
+        Program program = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
+        programService.addProgram( program );
+
+        ProgramStage stageA = new ProgramStage( "A", program );
+        programStageService.saveProgramStage( stageA );
+
+        ProgramStage stageB = new ProgramStage( "B", program );
+        programStageService.saveProgramStage( stageB );
+
+        Set<ProgramStage> programStages = new HashSet<ProgramStage>();
+        programStages.add( stageA );
+        programStages.add( stageB );
+        program.setProgramStages( programStages );
+        programService.updateProgram( program );
+
+        Calendar calYesterday = Calendar.getInstance();
+        calYesterday.add( Calendar.DATE, -1 );
+        yesterday = calYesterday.getTime();
+        Calendar calTomorrow = Calendar.getInstance();
+        calTomorrow.add( Calendar.DATE, 1 );
+        tomorrow = calTomorrow.getTime();
+
+        programInstance = programInstanceService.enrollPatient( patient, program, yesterday, yesterday,
+            organisationUnit, null );
+
+        stageInstanceA = programStageInstanceService.getProgramStageInstance( programInstance, stageA );
+        stageInstanceB = programStageInstanceService.getProgramStageInstance( programInstance, stageB );
+
+        dataValueA = new PatientDataValue( stageInstanceA, dataElementA, "A" );
+        dataValueB = new PatientDataValue( stageInstanceA, dataElementB, "B" );
+        dataValueC = new PatientDataValue( stageInstanceB, dataElementA, "C" );
+        dataValueD = new PatientDataValue( stageInstanceB, dataElementB, "D" );
+    }
+
+    @Test
+    public void testSavePatientDataValue()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+
+        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementA ) );
+        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementB ) );
+    }
+
+
+    @Test
+    public void testDeletePatientDataValueByStageInstance()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+        patientDataValueStore.saveVoid( dataValueC );
+        patientDataValueStore.saveVoid( dataValueD );
+
+        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementA ) );
+        assertNotNull( patientDataValueStore.get( stageInstanceA, dataElementB ) );
+        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementA ) );
+        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementB ) );
+
+        patientDataValueStore.delete( stageInstanceA );
+        assertNull( patientDataValueStore.get( stageInstanceA, dataElementA ) );
+        assertNull( patientDataValueStore.get( stageInstanceA, dataElementB ) );
+        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementA ) );
+        assertNotNull( patientDataValueStore.get( stageInstanceB, dataElementB ) );
+    }
+
+    @Test
+    public void testGetPatientDataValuesByStageInstance()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+        patientDataValueStore.saveVoid( dataValueC );
+        patientDataValueStore.saveVoid( dataValueD );
+
+        Collection<PatientDataValue> dataValues = patientDataValueStore.get( stageInstanceA );
+        assertEquals( 2, dataValues.size() );
+        assertTrue( dataValues.contains( dataValueA ) );
+        assertTrue( dataValues.contains( dataValueB ) );
+
+        dataValues = patientDataValueStore.get( stageInstanceB );
+        assertEquals( 2, dataValues.size() );
+        assertTrue( dataValues.contains( dataValueC ) );
+        assertTrue( dataValues.contains( dataValueD ) );
+    }
+
+    @Test
+    public void testGetPatientDataValuesByStageElement()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+        patientDataValueStore.saveVoid( dataValueC );
+        patientDataValueStore.saveVoid( dataValueD );
+
+        Collection<DataElement> dataElements = new HashSet<DataElement>();
+        dataElements.add( dataElementA );
+        dataElements.add( dataElementB );
+
+        Collection<PatientDataValue> dataValues = patientDataValueStore.get( stageInstanceA,
+            dataElements );
+        assertEquals( 2, dataValues.size() );
+        assertTrue( dataValues.contains( dataValueA ) );
+        assertTrue( dataValues.contains( dataValueB ) );
+    }
+
+    @Test
+    public void testGetPatientDataValues()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+        patientDataValueStore.saveVoid( dataValueC );
+        patientDataValueStore.saveVoid( dataValueD );
+
+        Collection<ProgramStageInstance> programStageInstances = new HashSet<ProgramStageInstance>();
+        programStageInstances.add( stageInstanceA );
+        programStageInstances.add( stageInstanceB );
+
+        Collection<PatientDataValue> dataValues = patientDataValueStore.get( programStageInstances );
+        assertEquals( 4, dataValues.size() );
+        assertTrue( dataValues.contains( dataValueA ) );
+        assertTrue( dataValues.contains( dataValueB ) );
+        assertTrue( dataValues.contains( dataValueC ) );
+        assertTrue( dataValues.contains( dataValueD ) );
+    }
+
+    @Test
+    public void testGetPatientDataValuesByDataElement()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+        patientDataValueStore.saveVoid( dataValueC );
+        patientDataValueStore.saveVoid( dataValueD );
+
+        Collection<PatientDataValue> dataValues = patientDataValueStore.get( dataElementA );
+        assertEquals( 2, dataValues.size() );
+        assertTrue( dataValues.contains( dataValueA ) );
+        assertTrue( dataValues.contains( dataValueC ) );
+
+        dataValues = patientDataValueStore.get( dataElementB );
+        assertEquals( 2, dataValues.size() );
+        assertTrue( dataValues.contains( dataValueB ) );
+        assertTrue( dataValues.contains( dataValueD ) );
+    }
+
+    @Test
+    public void testGetPatientDataValuesByPatientDataElement()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+        patientDataValueStore.saveVoid( dataValueC );
+        patientDataValueStore.saveVoid( dataValueD );
+
+        Collection<DataElement> dataElements = new HashSet<DataElement>();
+        dataElements.add( dataElementA );
+        dataElements.add( dataElementB );
+
+        Collection<PatientDataValue> dataValues = patientDataValueStore.get( patient, dataElements,
+            yesterday, tomorrow );
+
+        dataValues = patientDataValueStore.get( dataElementB );
+        assertEquals( 2, dataValues.size() );
+        assertTrue( dataValues.contains( dataValueB ) );
+        assertTrue( dataValues.contains( dataValueD ) );
+    }
+
+    @Test
+    public void testGetPatientDataValue()
+    {
+        patientDataValueStore.saveVoid( dataValueA );
+        patientDataValueStore.saveVoid( dataValueB );
+
+        PatientDataValue dataValue = patientDataValueStore.get( stageInstanceA, dataElementA );
+        assertEquals( dataValueA, dataValue );
+
+        dataValue = patientDataValueStore.get( stageInstanceA, dataElementB );
+        assertEquals( dataValueB, dataValue );
+    }
+
 }