diff --git a/jOOQ-test/src/org/jooq/test/_/testcases/EnumTests.java b/jOOQ-test/src/org/jooq/test/_/testcases/EnumTests.java index d13fba59e1..88c4902a8c 100644 --- a/jOOQ-test/src/org/jooq/test/_/testcases/EnumTests.java +++ b/jOOQ-test/src/org/jooq/test/_/testcases/EnumTests.java @@ -42,6 +42,9 @@ package org.jooq.test._.testcases; import static junit.framework.Assert.assertEquals; import static org.jooq.tools.reflect.Reflect.on; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.sql.Date; import java.util.List; @@ -147,9 +150,9 @@ extends BaseTest result = create().selectFrom(TBooleans()) - .where(TBooleans_ID().in(1, 2)) - .and(TBooleans_BOOLEAN_10().in(Boolean_10.ONE, Boolean_10.ZERO)) - .and(TBooleans_Boolean_TF_LC().in(Boolean_TF_LC.TRUE, Boolean_TF_LC.FALSE)) - .and(TBooleans_Boolean_TF_UC().in(Boolean_TF_UC.TRUE, Boolean_TF_UC.FALSE)) - .and(TBooleans_Boolean_YES_NO_LC().in(Boolean_YES_NO_LC.yes, Boolean_YES_NO_LC.no)) - .and(TBooleans_Boolean_YES_NO_UC().in(Boolean_YES_NO_UC.YES, Boolean_YES_NO_UC.NO)) - .and(TBooleans_Boolean_YN_LC().in(Boolean_YN_LC.y, Boolean_YN_LC.n)) - .and(TBooleans_Boolean_YN_UC().in(Boolean_YN_UC.Y, Boolean_YN_UC.N)) + .where(TBooleans_ID().in(1, 2, 3)) + .and(TBooleans_BOOLEAN_10().in(Boolean_10.ONE, Boolean_10.ZERO) + .or(TBooleans_BOOLEAN_10().isNull())) + .and(TBooleans_Boolean_TF_LC().in(Boolean_TF_LC.TRUE, Boolean_TF_LC.FALSE) + .or(TBooleans_Boolean_TF_LC().isNull())) + .and(TBooleans_Boolean_TF_UC().in(Boolean_TF_UC.TRUE, Boolean_TF_UC.FALSE) + .or(TBooleans_Boolean_TF_UC().isNull())) + .and(TBooleans_Boolean_YES_NO_LC().in(Boolean_YES_NO_LC.yes, Boolean_YES_NO_LC.no) + .or(TBooleans_Boolean_YES_NO_LC().isNull())) + .and(TBooleans_Boolean_YES_NO_UC().in(Boolean_YES_NO_UC.YES, Boolean_YES_NO_UC.NO) + .or(TBooleans_Boolean_YES_NO_UC().isNull())) + .and(TBooleans_Boolean_YN_LC().in(Boolean_YN_LC.y, Boolean_YN_LC.n) + .or(TBooleans_Boolean_YN_LC().isNull())) + .and(TBooleans_Boolean_YN_UC().in(Boolean_YN_UC.Y, Boolean_YN_UC.N) + .or(TBooleans_Boolean_YN_UC().isNull())) .orderBy(TBooleans_ID().asc()) .fetch(); assertEquals(1, (int) result.getValue(0, TBooleans_ID())); assertEquals(2, (int) result.getValue(1, TBooleans_ID())); + assertEquals(3, (int) result.getValue(2, TBooleans_ID())); assertEquals(Boolean_10.ZERO, result.getValue(0, TBooleans_BOOLEAN_10())); assertEquals(Boolean_10.ONE, result.getValue(1, TBooleans_BOOLEAN_10())); + assertNull(result.getValue(2, TBooleans_BOOLEAN_10())); assertEquals(Boolean_TF_LC.FALSE, result.getValue(0, TBooleans_Boolean_TF_LC())); assertEquals(Boolean_TF_LC.TRUE, result.getValue(1, TBooleans_Boolean_TF_LC())); + assertNull(result.getValue(2, TBooleans_Boolean_TF_LC())); assertEquals(Boolean_TF_UC.FALSE, result.getValue(0, TBooleans_Boolean_TF_UC())); assertEquals(Boolean_TF_UC.TRUE, result.getValue(1, TBooleans_Boolean_TF_UC())); + assertNull(result.getValue(2, TBooleans_Boolean_TF_UC())); assertEquals(Boolean_YES_NO_LC.no, result.getValue(0, TBooleans_Boolean_YES_NO_LC())); assertEquals(Boolean_YES_NO_LC.yes, result.getValue(1, TBooleans_Boolean_YES_NO_LC())); + assertNull(result.getValue(2, TBooleans_Boolean_YES_NO_LC())); assertEquals(Boolean_YES_NO_UC.NO, result.getValue(0, TBooleans_Boolean_YES_NO_UC())); assertEquals(Boolean_YES_NO_UC.YES, result.getValue(1, TBooleans_Boolean_YES_NO_UC())); + assertNull(result.getValue(2, TBooleans_Boolean_YES_NO_UC())); assertEquals(Boolean_YN_LC.n, result.getValue(0, TBooleans_Boolean_YN_LC())); assertEquals(Boolean_YN_LC.y, result.getValue(1, TBooleans_Boolean_YN_LC())); + assertNull(result.getValue(2, TBooleans_Boolean_YN_LC())); assertEquals(Boolean_YN_UC.N, result.getValue(0, TBooleans_Boolean_YN_UC())); assertEquals(Boolean_YN_UC.Y, result.getValue(1, TBooleans_Boolean_YN_UC())); + assertNull(result.getValue(2, TBooleans_Boolean_YN_UC())); -// assertFalse(result.getValue(0, TBooleans_C())); -// assertTrue(result.getValue(1, TBooleans_C())); -// -// assertFalse(result.getValue(0, TBooleans_VC())); -// assertTrue(result.getValue(1, TBooleans_VC())); -// -// assertFalse(result.getValue(0, TBooleans_N())); -// assertTrue(result.getValue(1, TBooleans_N())); + assertFalse(result.getValue(0, TBooleans_C())); + assertTrue(result.getValue(1, TBooleans_C())); + assertNull(result.getValue(2, TBooleans_C())); + + assertFalse(result.getValue(0, TBooleans_VC())); + assertTrue(result.getValue(1, TBooleans_VC())); + assertNull(result.getValue(2, TBooleans_VC())); + + assertFalse(result.getValue(0, TBooleans_N())); + assertTrue(result.getValue(1, TBooleans_N())); + assertNull(result.getValue(2, TBooleans_N())); // Conversion to custom POJOs // -------------------------------------------------------------------- @@ -226,30 +262,38 @@ extends BaseTest