← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16661: in sharing tests, also test for size by using getCount

 

------------------------------------------------------------
revno: 16661
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-09-09 11:35:55 +0700
message:
  in sharing tests, also test for size by using getCount
modified:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.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/common/IdentifiableObjectManagerTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java	2014-09-08 13:02:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java	2014-09-09 04:35:55 +0000
@@ -46,11 +46,9 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -307,9 +305,8 @@
         identifiableObjectManager.save( createDataElement( 'C' ) );
         identifiableObjectManager.save( createDataElement( 'D' ) );
 
-        Collection<DataElement> all = identifiableObjectManager.getAll( DataElement.class );
-
-        assertEquals( 4, all.size() );
+        assertEquals( 4, identifiableObjectManager.getCount( DataElement.class ) );
+        assertEquals( 4, identifiableObjectManager.getAll( DataElement.class ).size() );
     }
 
     @Test
@@ -337,6 +334,7 @@
             sessionFactory.getCurrentSession().update( dataElement );
         }
 
+        assertEquals( 0, identifiableObjectManager.getCount( DataElement.class ) );
         assertEquals( 0, identifiableObjectManager.getAll( DataElement.class ).size() );
     }
 
@@ -356,6 +354,7 @@
         identifiableObjectManager.save( createDataElement( 'C' ) );
         identifiableObjectManager.save( createDataElement( 'D' ) );
 
+        assertEquals( 4, identifiableObjectManager.getCount( DataElement.class ) );
         assertEquals( 4, identifiableObjectManager.getAll( DataElement.class ).size() );
 
         List<DataElement> dataElements = new ArrayList<>( identifiableObjectManager.getAll( DataElement.class ) );
@@ -375,6 +374,7 @@
             sessionFactory.getCurrentSession().update( dataElement );
         }
 
+        assertEquals( 4, identifiableObjectManager.getCount( DataElement.class ) );
         assertEquals( 4, identifiableObjectManager.getAll( DataElement.class ).size() );
     }
 }