コード例 #1
0
 public void testAllThere() throws Exception {
   for (int i = 0; i < FOOS.length; i++) {
     Query q = createQuery(FOOS[i]);
     ObjectSet objectSet = q.execute();
     Assert.areEqual(1, objectSet.size());
     FieldIndexItem fii = (FieldIndexItem) objectSet.next();
     Assert.areEqual(FOOS[i], fii.foo);
   }
 }
コード例 #2
0
ファイル: SodaTest.java プロジェクト: superyfwy/db4o
 private void expect(Query query, Object[] results, boolean ordered) {
   testCases++;
   ObjectSet set = query.execute();
   if (results == null || results.length == 0) {
     if (set.size() > 0) {
       error("No content expected.");
     }
     return;
   }
   int j = 0;
   if (set.size() == results.length) {
     while (set.hasNext()) {
       Object obj = set.next();
       boolean found = false;
       if (ordered) {
         if (comparer.isEqual(results[j], obj)) {
           results[j] = null;
           found = true;
         }
         j++;
       } else {
         for (int i = 0; i < results.length; i++) {
           if (results[i] != null) {
             if (comparer.isEqual(results[i], obj)) {
               results[i] = null;
               found = true;
               break;
             }
           }
         }
       }
       if (!found) {
         error("Object not expected: " + obj);
       }
     }
     for (int i = 0; i < results.length; i++) {
       if (results[i] != null) {
         error("Expected object not returned: " + results[i]);
       }
     }
   } else {
     error("Unexpected size returned.\nExpected: " + results.length + " Returned: " + set.size());
   }
 }
コード例 #3
0
ファイル: SodaTest.java プロジェクト: superyfwy/db4o
 public void log(Query query) {
   ObjectSet set = query.execute();
   while (set.hasNext()) {
     TLogger.log(set.next());
   }
 }