Skip to content

Commit

Permalink
test queries for null values
Browse files Browse the repository at this point in the history
  • Loading branch information
neilw4 committed Apr 1, 2015
1 parent cf8c3f5 commit 4d67bfb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions library/src/test/java/com/orm/query/SelectTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.orm.query;

import com.orm.query.Condition;

import junit.framework.TestResult;

import org.junit.Test;

import static junit.framework.Assert.assertEquals;
Expand Down Expand Up @@ -80,5 +84,27 @@ public void testOr(){
assertEquals("2", where.getArgs()[1]);
}

@Test
public void testIsNull() {
Select where = Select.from(TestRecord.class).where(Condition.prop("test").isNull());
assertEquals("(test IS NULL )", where.getWhereCond());
assertEquals(0, where.getArgs().length);

where = Select.from(TestRecord.class).where(Condition.prop("test").eq(null));
assertEquals("(test IS NULL )", where.getWhereCond());
assertEquals(0, where.getArgs().length);
}

@Test
public void testIsNotNull() {
Select where = Select.from(TestRecord.class).where(Condition.prop("test").isNotNull());
assertEquals("(test IS NOT NULL )", where.getWhereCond());
assertEquals(0, where.getArgs().length);

where = Select.from(TestRecord.class).where(Condition.prop("test").notEq(null));
assertEquals("(test IS NOT NULL )", where.getWhereCond());
assertEquals(0, where.getArgs().length);
}


}

0 comments on commit 4d67bfb

Please sign in to comment.