Examples of TestFailure


Examples of junit.framework.TestFailure

     * @param theTest the test object that failed
     * @param theError the exception that was thrown
     */
    public void addFailure(Test theTest, AssertionFailedError theError)
    {
        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 + ">");

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

Examples of junit.framework.TestFailure

    System.out.println("Runs " + testResult.runCount() + ", Errors: "
        + testResult.errorCount());

    Enumeration e = testResult.errors();
    while (e.hasMoreElements()) {
      TestFailure f = (TestFailure) e.nextElement();
      System.out.println(f);
      System.out.println(f.exceptionMessage());
    }

    Assert.assertEquals(0, testResult.errorCount());

  }
View Full Code Here

Examples of junit.framework.TestFailure

     * @param theTest the test object that failed
     * @param theThrowable the exception that was thrown
     */
    public void addError(Test theTest, Throwable theThrowable)
    {
        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 + ">");

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

Examples of junit.framework.TestFailure

     * @param theTest the test object that failed
     * @param theError the exception that was thrown
     */
    public void addFailure(Test theTest, AssertionFailedError theError)
    {
        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 + ">");

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

Examples of junit.framework.TestFailure

        AntUnitTestCase antUnitTestCase = new AntUnitTestCase(unknownName);
        antUnitTestCase.run(testResult);

        assertEquals(1 , testResult.errorCount());
        TestFailure error = (TestFailure) testResult.errors().nextElement();
        assertSame(antUnitTestCase, error.failedTest());
        assertTrue("Unexpected error : " + error.exceptionMessage(),
                error.exceptionMessage().contains("unknown"));
    }
View Full Code Here

Examples of junit.framework.TestFailure

        AntUnitTestCase antUnitTestCase = new AntUnitTestCase(nameForInvalidF);
        antUnitTestCase.run(testResult);

        assertEquals(1 , testResult.errorCount());
        TestFailure error = (TestFailure) testResult.errors().nextElement();
        assertSame(antUnitTestCase, error.failedTest());
        assertTrue("Unexpected error : " + error.exceptionMessage(),
                error.exceptionMessage().contains("invalidFile"));
    }
View Full Code Here

Examples of junit.framework.TestFailure

        TestResult testResult = new TestResult();
        suite.run(testResult);
       
        assertNotNull(suite.getName());
        assertEquals(1 , testResult.errorCount());
        TestFailure error = (TestFailure) testResult.errors().nextElement();
        assertTrue("Unexpected error : " + error.exceptionMessage(),
                error.exceptionMessage().contains("xxxx"));
    }
View Full Code Here

Examples of junit.framework.TestFailure

     * @param theTest the test object that failed
     * @param theThrowable the exception that was thrown
     */
    public void addError(Test theTest, Throwable theThrowable)
    {
        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 + ">");

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

Examples of junit.framework.TestFailure

     * @param theTest the test object that failed
     * @param theError the exception that was thrown
     */
    public void addFailure(Test theTest, AssertionFailedError theError)
    {
        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 + ">");

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

Examples of junit.framework.TestFailure

       
        if(failureCount > 0){
            List<TestFailureResult> l = new ArrayList<TestFailureResult>();
            Enumeration<TestFailure> failures = result.failures();
            while(failures.hasMoreElements()){
                TestFailure failure = failures.nextElement();

                TestFailureResultBean t = new TestFailureResultBean();
                t.setExceptionMessage(failure.exceptionMessage());
                t.setLineNumber(getLineNumber(failure.trace()));
                l.add(t);
            }
            resultBean.setFailures(l);
        }
       
        if(errorCount > 0){
            List<TestFailureResult> l = new ArrayList<TestFailureResult>();
            Enumeration<TestFailure> errors = result.errors();
            while(errors.hasMoreElements()){
                TestFailure error = errors.nextElement();
               
                TestFailureResultBean t = new TestFailureResultBean();
                t.setExceptionMessage(error.exceptionMessage());
                t.setLineNumber(getLineNumber(error.trace()));
                l.add(t);
            }
            resultBean.setErrors(l);
        }
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.