1 21 package com.db4o.db4ounit.common.soda.util; 22 23 import com.db4o.query.*; 24 25 import db4ounit.extensions.*; 26 27 public abstract class SodaBaseTestCase extends AbstractDb4oTestCase { 28 29 protected transient Object [] _array; 30 31 protected void db4oSetupBeforeStore() throws Exception { 32 _array=createData(); 33 } 34 35 protected void store() { 36 Object [] data=createData(); 37 for (int idx = 0; idx < data.length; idx++) { 38 db().set(data[idx]); 39 } 40 } 41 42 public abstract Object [] createData(); 43 44 protected void expect(Query query, int[] indices) { 45 SodaTestUtil.expect(query, collectCandidates(indices), false); 46 } 47 48 protected void expectOrdered(Query query, int[] indices) { 49 SodaTestUtil.expectOrdered(query, collectCandidates(indices)); 50 } 51 52 private Object [] collectCandidates(int[] indices) { 53 Object [] data=new Object [indices.length]; 54 for (int idx = 0; idx < indices.length; idx++) { 55 data[idx]=_array[indices[idx]]; 56 } 57 return data; 58 } 59 } 60 | Popular Tags |