Exemplo n.º 1
0
 /* Run a single test and decide whether the test was
  * successful, meaningless, or a failure.  This is the
  * Template Method pattern abstraction of the inner loop in a
  * JML/JUnit test. */
 public void runTest() throws java.lang.Throwable {
   try {
     // The call being tested!
     doCall();
   } catch (org.jmlspecs.jmlrac.runtime.JMLEntryPreconditionError e) {
     // meaningless test input
     addMeaningless();
   } catch (org.jmlspecs.jmlrac.runtime.JMLAssertionError e) {
     // test failure
     int l = org.jmlspecs.jmlrac.runtime.JMLChecker.getLevel();
     org.jmlspecs.jmlrac.runtime.JMLChecker.setLevel(org.jmlspecs.jmlrac.runtime.JMLOption.NONE);
     try {
       java.lang.String failmsg = this.failMessage(e);
       junit.framework.AssertionFailedError err =
           new junit.framework.AssertionFailedError(failmsg);
       err.setStackTrace(new java.lang.StackTraceElement[] {});
       err.initCause(e);
       result.addFailure(this, err);
     } finally {
       org.jmlspecs.jmlrac.runtime.JMLChecker.setLevel(l);
     }
   } catch (java.lang.Throwable e) {
     // test success
   }
 }
Exemplo n.º 2
0
 /**
  * Test to see if the code for class E_OneWayList has been compiled with runtime assertion
  * checking (i.e., by jmlc). Code that is not compiled with jmlc would not make an effective test,
  * since no assertion checking would be done.
  */
 public void test$IsRACCompiled() {
   junit.framework.Assert.assertTrue(
       "code for class E_OneWayList"
           + " was not compiled with jmlc"
           + " so no assertions will be checked!",
       org.jmlspecs.jmlrac.runtime.JMLChecker.isRACCompiled(E_OneWayList.class));
 }
 /**
  * Test to see if the code for class SearchableDigraph has been compiled with runtime assertion
  * checking (i.e., by jmlc). Code that is not compiled with jmlc would not make an effective test,
  * since no assertion checking would be done.
  */
 public void test$IsRACCompiled() {
   junit.framework.Assert.assertTrue(
       "code for class SearchableDigraph"
           + " was not compiled with jmlc"
           + " so no assertions will be checked!",
       org.jmlspecs.jmlrac.runtime.JMLChecker.isRACCompiled(SearchableDigraph.class));
 }
 /**
  * Test to see if the code for class CloneableObjectArrayAbstractIterator has been compiled with
  * runtime assertion checking (i.e., by jmlc). Code that is not compiled with jmlc would not make
  * an effective test, since no assertion checking would be done.
  */
 public void test$IsRACCompiled() {
   junit.framework.Assert.assertTrue(
       "code for class CloneableObjectArrayAbstractIterator"
           + " was not compiled with jmlc"
           + " so no assertions will be checked!",
       org.jmlspecs.jmlrac.runtime.JMLChecker.isRACCompiled(
           CloneableObjectArrayAbstractIterator.class));
 }