1 21 package com.db4o.db4ounit.common.soda.classes.typedhierarchy; 22 import com.db4o.query.*; 23 24 25 26 public class STSDFT1TestCase extends com.db4o.db4ounit.common.soda.util.SodaBaseTestCase{ 27 28 public STSDFT1TestCase(){ 29 } 30 31 public Object [] createData() { 32 return new Object []{ 33 new STSDFT1TestCase(), 34 new STSDFT2(), 35 new STSDFT2("str1"), 36 new STSDFT2("str2"), 37 new STSDFT3(), 38 new STSDFT3("str1"), 39 new STSDFT3("str3") 40 }; 41 } 42 43 public void testStrNull(){ 44 Query q = newQuery(); 45 q.constrain(new STSDFT1TestCase()); 46 q.descend("foo").constrain(null); 47 48 expect(q, new int[] {0, 1, 4}); 49 } 50 51 public void testStrVal(){ 52 Query q = newQuery(); 53 q.constrain(STSDFT1TestCase.class); 54 q.descend("foo").constrain("str1"); 55 56 expect(q, new int[] {2, 5}); 57 } 58 59 public void testOrValue(){ 60 Query q = newQuery(); 61 q.constrain(STSDFT1TestCase.class); 62 Query foo = q.descend("foo"); 63 foo.constrain("str1").or(foo.constrain("str2")); 64 65 expect(q, new int[] {2, 3, 5}); 66 } 67 68 public void testOrNull(){ 69 Query q = newQuery(); 70 q.constrain(STSDFT1TestCase.class); 71 Query foo = q.descend("foo"); 72 foo.constrain("str1").or(foo.constrain(null)); 73 74 expect(q, new int[] {0, 1, 2, 4, 5}); 75 } 76 77 public void testTripleOrNull(){ 78 Query q = newQuery(); 79 q.constrain(STSDFT1TestCase.class); 80 Query foo = q.descend("foo"); 81 foo.constrain("str1").or(foo.constrain(null)).or(foo.constrain("str2")); 82 83 expect(q, new int[] {0, 1, 2,3, 4, 5}); 84 } 85 86 88 97 } 98 99 | Popular Tags |