Package junit.framework

Examples of junit.framework.TestResult.errors()


                new SecurityTestResultPrinter(System.out).print(result);
                fail("Security test was expected to run successfully, but failed (results on System.out)");
            } else {
                //There may be more than 1 failure:  iterate to ensure that they all match the missingPermission.
                boolean otherFailure = false;
                for (Enumeration e = result.errors(); e.hasMoreElements();) {
                    TestFailure failure = (TestFailure) e.nextElement();
                    if (failure.thrownException() instanceof AccessControlException) {
                        AccessControlException ace = (AccessControlException) failure.thrownException();
                        if (missingPermission.implies(ace.getPermission())) {
                            continue;
View Full Code Here


                        buftrace.append( item.toString() );
                        buftrace.append("\n");
                        buftrace.append( "Trace -- ");
                        buftrace.append( item.trace() );
                    }
                    en = tr.errors();
                    if (en.hasMoreElements()){
                        sresult.setResponseCode(getErrorCode());
                        buf.append( getError() );
                        buf.append("\n");
                    }
View Full Code Here

            Debug.logInfo("[JUNIT] Results for test suite: " + suite.getName(), module);
            Debug.logInfo("[JUNIT] Pass: " + results.wasSuccessful() + " | # Tests: " + results.runCount() + " | # Failed: " +
                    results.failureCount() + " # Errors: " + results.errorCount(), module);
            if (Debug.importantOn()) {
                Debug.logInfo("[JUNIT] ----------------------------- ERRORS ----------------------------- [JUNIT]", module);
                Enumeration<?> err = results.errors();
                if (!err.hasMoreElements()) {
                    Debug.logInfo("None", module);
                } else {
                    while (err.hasMoreElements()) {
                        Object error = err.nextElement();
View Full Code Here

            Debug.log("[JUNIT] Results for test suite: " + suite.getName());
            Debug.log("[JUNIT] Pass: " + results.wasSuccessful() + " | # Tests: " + results.runCount() + " | # Failed: " +
                    results.failureCount() + " # Errors: " + results.errorCount(), module);
            if (Debug.importantOn()) {
                Debug.log("[JUNIT] ----------------------------- ERRORS ----------------------------- [JUNIT]", module);
                Enumeration<?> err = results.errors();
                if (!err.hasMoreElements()) {
                    Debug.log("None");
                } else {
                    while (err.hasMoreElements()) {
                        Object error = err.nextElement();
View Full Code Here

            }
            if ( !tr.wasSuccessful() ){
                sresult.setSuccessful(false);
                StringBuffer buf = new StringBuffer();
                buf.append( getFailure() );
                Enumeration en = tr.errors();
                while (en.hasMoreElements()){
                    Object item = en.nextElement();
                    if (getAppendError() && item instanceof TestFailure) {
                        buf.append( "Trace -- ");
                        buf.append( ((TestFailure)item).trace() );
View Full Code Here

    TestResult testResult = new TestResult();
    allTests.run(testResult);
    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());
    }
View Full Code Here

        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

        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

        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"));
    }
   
    //TODO test missing target error reporting
View Full Code Here

            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());
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.