1 21 package com.db4o.db4ounit.common.soda.experiments; 22 import com.db4o.query.*; 23 24 25 public class STCaseInsensitiveTestCase extends com.db4o.db4ounit.common.soda.util.SodaBaseTestCase { 26 27 public String str; 28 29 30 public STCaseInsensitiveTestCase() { 31 } 32 33 public STCaseInsensitiveTestCase(String str) { 34 this.str = str; 35 } 36 37 public Object [] createData() { 38 return new Object [] { 39 new STCaseInsensitiveTestCase("Hihoho"), 40 new STCaseInsensitiveTestCase("Hello"), 41 new STCaseInsensitiveTestCase("hello") 42 }; 43 } 44 45 public void test() { 46 Query q = newQuery(); 47 q.constrain(STCaseInsensitiveTestCase.class); 48 q.descend("str").constrain(new Evaluation() { 49 public void evaluate(Candidate candidate) { 50 candidate.include(candidate.getObject().toString().toLowerCase().startsWith("hell")); 51 } 52 }); 53 54 expect(q, new int[] { 1, 2 }); 55 } 56 57 } 58 59 | Popular Tags |