1 21 package com.db4o.test.legacy.soda.wrapper.untyped; 22 23 24 import com.db4o.query.*; 25 import com.db4o.test.legacy.soda.*; 26 27 public class STBooleanWU implements STClass1{ 28 29 final static String DESCENDANT = "i_boolean"; 30 31 public static transient SodaTest st; 32 33 public Object i_boolean; 34 35 public STBooleanWU(){ 36 } 37 38 private STBooleanWU(boolean a_boolean){ 39 i_boolean = new Boolean (a_boolean); 40 } 41 42 public Object [] store() { 43 return new Object []{ 44 new STBooleanWU(false), 45 new STBooleanWU(true), 46 new STBooleanWU(false), 47 new STBooleanWU(false), 48 new STBooleanWU() 49 }; 50 } 51 52 public void testEqualsTrue(){ 53 Query q = st.query(); 54 q.constrain(new STBooleanWU(true)); 55 Object [] r = store(); 56 st.expectOne(q, new STBooleanWU(true)); 57 } 58 59 public void testEqualsFalse(){ 60 Query q = st.query(); 61 q.constrain(new STBooleanWU(false)); 62 q.descend(DESCENDANT).constrain(new Boolean (false)); 63 Object [] r = store(); 64 st.expect(q, new Object [] {r[0], r[2], r[3]}); 65 } 66 67 public void testNull(){ 68 Query q = st.query(); 69 q.constrain(new STBooleanWU()); 70 q.descend(DESCENDANT).constrain(null); 71 Object [] r = store(); 72 st.expectOne(q, new STBooleanWU()); 73 } 74 75 public void testNullOrTrue(){ 76 Query q = st.query(); 77 q.constrain(new STBooleanWU()); 78 Query qd = q.descend(DESCENDANT); 79 qd.constrain(null).or(qd.constrain(new Boolean (true))); 80 Object [] r = store(); 81 st.expect(q, new Object [] {r[1], r[4]}); 82 } 83 84 public void testNotNullAndFalse(){ 85 Query q = st.query(); 86 q.constrain(new STBooleanWU()); 87 Query qd = q.descend(DESCENDANT); 88 qd.constrain(null).not().and(qd.constrain(new Boolean (false))); 89 Object [] r = store(); 90 st.expect(q, new Object [] {r[0], r[2], r[3]}); 91 } 92 93 } 94 95 | Popular Tags |