private void withCache(final Procedure4<ClientSlotCache> procedure) {
   ClientSlotCache clientSlotCache = null;
   try {
     clientSlotCache =
         (ClientSlotCache) Reflection4.getFieldValue(container(), "_clientSlotCache");
   } catch (ReflectException e) {
     Assert.fail("Can't get field _clientSlotCache on  container. " + e.toString());
   }
   procedure.apply(clientSlotCache);
 }
Ejemplo n.º 2
0
 public void run() {
   Assert.areEqual(_idx, _counter.value);
   _counter.value++;
   if (_fail) {
     Assert.fail();
   }
 }
 private void checkConsistency() {
   ConsistencyReport report =
       new ConsistencyChecker((LocalObjectContainer) container()).checkSlotConsistency();
   if (!report.consistent()) {
     Assert.fail(report.toString());
   }
 }
Ejemplo n.º 4
0
 public static void runTestAndExpect(
     final Iterable4 tests, int expFailures, boolean checkException) {
   final TestResult result = new TestResult();
   new TestRunner(tests).run(result);
   if (expFailures != result.failures().size()) {
     Assert.fail(result.failures().toString());
   }
   if (checkException) {
     for (Iterator4 iter = result.failures().iterator(); iter.moveNext(); ) {
       TestFailure failure = (TestFailure) iter.current();
       Assert.areEqual(EXCEPTION, failure.reason());
     }
   }
 }
Ejemplo n.º 5
0
 private static void unexpected(Object element) {
   Assert.fail("Unexpected element: " + element);
 }