Package junit.framework

Examples of junit.framework.TestFailure.thrownException()


            int i= 1;
            for (Enumeration e= testResult.errors(); e.hasMoreElements(); i++) {
                TestFailure failure= (TestFailure)e.nextElement();
                userLog().info(i + ") " + failure.failedTest());
                userLog().info(BaseTestRunner.getFilteredTrace(failure.thrownException()));
            }
        }
    }
    /**
     * Prints failures to the standard output
View Full Code Here


                userLog().info("There were " + testResult.failureCount() + " failures:");
            int i = 1;
            for (Enumeration e= testResult.failures(); e.hasMoreElements(); i++) {
                TestFailure failure= (TestFailure) e.nextElement();
                userLog().info(i + ") " + failure.failedTest());
                userLog().info(BaseTestRunner.getFilteredTrace(failure.thrownException()));
            }
        }
    }
    /**
     * Prints the header of the report
View Full Code Here

   */
  public static void unpackProblems(TestResult result, OsgiTestInfoHolder holder) {
    Enumeration errors = result.errors();
    while (errors.hasMoreElements()) {
      TestFailure failure = (TestFailure) errors.nextElement();
      holder.addTestError(failure.thrownException());
    }
    Enumeration failures = result.failures();
    while (failures.hasMoreElements()) {
      TestFailure failure = (TestFailure) failures.nextElement();
      holder.addTestFailure(failure.thrownException());
View Full Code Here

      holder.addTestError(failure.thrownException());
    }
    Enumeration failures = result.failures();
    while (failures.hasMoreElements()) {
      TestFailure failure = (TestFailure) failures.nextElement();
      holder.addTestFailure(failure.thrownException());
    }
  }
}
View Full Code Here

  }

  public void testExceptionClass() throws Exception {
    executeTest("testException");
    TestFailure failure = (TestFailure) result.errors().nextElement();
    assertTrue(failure.thrownException() instanceof RuntimeException);
  }

  public void testError() {
    executeTest("testError");
    assertEquals("error not considered", 1, result.errorCount());
View Full Code Here

  }

  public void testErrorClass() throws Exception {
    executeTest("testError");
    TestFailure failure = (TestFailure) result.errors().nextElement();
    assertTrue(failure.thrownException() instanceof Error);
  }

  private void executeTest(String testMethod) {
    test.setName(testMethod);
    test.run(result);
View Full Code Here

    {
        TestFailure failure = new TestFailure(theTest, theThrowable);
        StringBuffer xml = new StringBuffer();

        xml.append("<" + ERROR + " " + ATTR_MESSAGE + "=\""
            + xmlEncode(failure.thrownException().getMessage()) + "\" "
            + ATTR_TYPE + "=\""
            + failure.thrownException().getClass().getName() + "\">");
        xml.append(xmlEncode(StringUtil.exceptionToString(
            failure.thrownException(), DEFAULT_STACK_FILTER_PATTERNS)));
        xml.append("</" + ERROR + ">");
View Full Code Here

        StringBuffer xml = new StringBuffer();

        xml.append("<" + ERROR + " " + ATTR_MESSAGE + "=\""
            + xmlEncode(failure.thrownException().getMessage()) + "\" "
            + ATTR_TYPE + "=\""
            + failure.thrownException().getClass().getName() + "\">");
        xml.append(xmlEncode(StringUtil.exceptionToString(
            failure.thrownException(), DEFAULT_STACK_FILTER_PATTERNS)));
        xml.append("</" + ERROR + ">");

        this.currentTestFailure = xml.toString();
View Full Code Here

        xml.append("<" + ERROR + " " + ATTR_MESSAGE + "=\""
            + xmlEncode(failure.thrownException().getMessage()) + "\" "
            + ATTR_TYPE + "=\""
            + failure.thrownException().getClass().getName() + "\">");
        xml.append(xmlEncode(StringUtil.exceptionToString(
            failure.thrownException(), DEFAULT_STACK_FILTER_PATTERNS)));
        xml.append("</" + ERROR + ">");

        this.currentTestFailure = xml.toString();
    }
View Full Code Here

    {
        TestFailure failure = new TestFailure(theTest, theError);
        StringBuffer xml = new StringBuffer();

        xml.append("<" + FAILURE + " " + ATTR_MESSAGE + "=\""
            + xmlEncode(failure.thrownException().getMessage()) + "\" "
            + ATTR_TYPE + "=\""
            + failure.thrownException().getClass().getName() + "\">");
        xml.append(xmlEncode(StringUtil.exceptionToString(
            failure.thrownException(), DEFAULT_STACK_FILTER_PATTERNS)));
        xml.append("</" + FAILURE + ">");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.