← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18347: more tests in QueryTest

 

------------------------------------------------------------
revno: 18347
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-02-20 11:03:39 +0700
message:
  more tests in QueryTest
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Restrictions.java
  dhis-2/dhis-api/src/test/java/org/hisp/dhis/query/QueryTest.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/query/Restrictions.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Restrictions.java	2015-02-18 13:08:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Restrictions.java	2015-02-20 04:03:39 +0000
@@ -70,11 +70,6 @@
 
     public static Restriction like( String path, Object value )
     {
-        if ( !String.class.isInstance( value ) )
-        {
-            throw new RestrictionException( "Invalid type for LIKE operator, only String is allowed." );
-        }
-
         return new Restriction( path, Operator.LIKE, value );
     }
 

=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/query/QueryTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/query/QueryTest.java	2015-02-20 03:59:30 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/query/QueryTest.java	2015-02-20 04:03:39 +0000
@@ -62,6 +62,11 @@
         schema.addProperty( createProperty( Date.class, "created", true, true ) );
         schema.addProperty( createProperty( Date.class, "lastUpdated", true, true ) );
 
+        schema.addProperty( createProperty( Integer.class, "int", true, true ) );
+        schema.addProperty( createProperty( Long.class, "long", true, true ) );
+        schema.addProperty( createProperty( Float.class, "float", true, true ) );
+        schema.addProperty( createProperty( Double.class, "double", true, true ) );
+
         return schema;
     }
 
@@ -105,6 +110,11 @@
         assertTrue( Operator.BETWEEN.isValid( schema.getProperty( "id" ) ) );
         assertTrue( Operator.LIKE.isValid( schema.getProperty( "id" ) ) );
 
+        assertTrue( Operator.EQ.isValid( schema.getProperty( "int" ) ) );
+        assertTrue( Operator.EQ.isValid( schema.getProperty( "long" ) ) );
+        assertTrue( Operator.EQ.isValid( schema.getProperty( "float" ) ) );
+        assertTrue( Operator.EQ.isValid( schema.getProperty( "double" ) ) );
+
         assertFalse( Operator.LIKE.isValid( schema.getProperty( "lastUpdated" ) ) );
     }
 }