← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18327: added sortNameAsc to QueryServiceTest

 

------------------------------------------------------------
revno: 18327
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-02-19 12:29:07 +0700
message:
  added sortNameAsc to QueryServiceTest
modified:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.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-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.java	2015-02-18 13:26:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.java	2015-02-19 05:29:07 +0000
@@ -338,6 +338,26 @@
     }
 
     @Test
+    public void sortNameAsc()
+    {
+        createDataElements();
+        Schema schema = schemaService.getDynamicSchema( DataElement.class );
+
+        Query query = Query.from( schema );
+        query.addOrder( new Order( schema.getProperty( "name" ), true ) );
+        Result result = queryService.query( query );
+
+        assertEquals( 6, result.size() );
+
+        assertEquals( "deabcdefghA", result.getItems().get( 0 ).getUid() );
+        assertEquals( "deabcdefghB", result.getItems().get( 1 ).getUid() );
+        assertEquals( "deabcdefghC", result.getItems().get( 2 ).getUid() );
+        assertEquals( "deabcdefghD", result.getItems().get( 3 ).getUid() );
+        assertEquals( "deabcdefghE", result.getItems().get( 4 ).getUid() );
+        assertEquals( "deabcdefghF", result.getItems().get( 5 ).getUid() );
+    }
+
+    @Test
     public void sortCreatedDesc()
     {
         createDataElements();