Package junit.framework

Examples of junit.framework.TestResult.errors()


                        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


            }
            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

            resultBean.setFailures(l);
        }
       
        if(errorCount > 0){
            List<TestExceptionResult> l = new ArrayList<TestExceptionResult>();
            Enumeration<TestFailure> errors = result.errors();
            while(errors.hasMoreElements()){
                TestFailure error = errors.nextElement();
               
                TestExceptionResultBean t = new TestExceptionResultBean();
                t.setExceptionMessage(error.exceptionMessage());
View Full Code Here

    testsuite.addTestSuite(CollectionExpressionsTest.class);
    testsuite.addTestSuite(UtilityTest.class);
   
    TestResult result=new TestResult();
    testsuite.run(result);
    Enumeration enm=result.errors();
    while(enm.hasMoreElements()){
      TestFailure ob=(TestFailure)enm.nextElement();
      System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
      logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
    }
View Full Code Here

      TestFailure ob=(TestFailure)enm1.nextElement();
      System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
      logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
    }
   
    System.out.println("result errorCount "+result.errorCount()+ " result failureCount "+ result.failureCount()+ " result status "+result.wasSuccessful()+ result.errors()
        );
  }

}
View Full Code Here

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

                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

  @Test
  public void initializationErrorsAreThrownAtRuntime() {
    TestResult result= new TestResult();
    fAdapter.run(result);
    assertEquals(1, result.errorCount());
    assertEquals(CantInitialize.UNIQUE_ERROR_MESSAGE, result.errors()
        .nextElement().exceptionMessage());
  }

  private final class ErrorRememberingListener implements TestListener {
    private junit.framework.Test fError;
View Full Code Here

        suite.run(r);
        int runCount = r.runCount();
        int failureCount = r.failureCount();
        System.out.println((runCount - failureCount) + "/" + runCount + " tests succeeded!");
        if (!r.wasSuccessful()) {
            Enumeration en = r.errors();
            while (en.hasMoreElements()) {
                TestFailure tf = (TestFailure) en.nextElement();
                System.out.println(tf.toString());
            }
View Full Code Here

  }
  public void testException() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(ErrorTest.class);
    adapter.run(result);
    assertEquals(exception, result.errors().nextElement().thrownException());
  }
 
  public void testNotifyResult() {
    JUnit4TestAdapter adapter= new JUnit4TestAdapter(ErrorTest.class);
    TestResult result= new TestResult();
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.