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