Package junit.framework

Examples of junit.framework.TestResult.errors()


  public void testInvalidMethod() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(InvalidMethodTest.class);
    adapter.run(result);
    assertEquals(1, result.errorCount())
    TestFailure failure= result.errors().nextElement();
    assertTrue(failure.exceptionMessage().contains("Method shouldBeStatic() should be static"));
  }
 
  private static boolean wasRun= false;
 
View Full Code Here


           
            if (m_failures.size() > 0) {
                System.out.println("\nTests in error:");
                for (int i = 0; i < m_errors.size(); i++) {
                    TestResult tr = (TestResult) m_errors.get(i);
                    Enumeration e = tr.errors();
                    while (e.hasMoreElements()) {
                        TestFailure tf = (TestFailure) e.nextElement();
                        System.out.println(" " + tf.toString());
                    }
                }
View Full Code Here

        if (result.failureCount() != 0) {
            Enumeration e = result.failures();
            return ((TestFailure)e.nextElement()).thrownException();
        }
        else if (result.errorCount() != 0) {
            Enumeration e = result.errors();
            return ((TestFailure)e.nextElement()).thrownException();
        }
        return null;
    }
View Full Code Here

        if (result.failureCount() != 0) {
            Enumeration e = result.failures();
            return ((TestFailure)e.nextElement()).thrownException();
        }
        else if (result.errorCount() != 0) {
            Enumeration e = result.errors();
            return ((TestFailure)e.nextElement()).thrownException();
        }
        return null;
    }
View Full Code Here

              Failure failure = null;
             
              if (result.failures().hasMoreElements()) {
                failure = new Failure(description, result.failures().nextElement().thrownException());
              }
              else if (result.errors().hasMoreElements()) {
                failure = new Failure(description, result.errors().nextElement().thrownException());
              }
             
              notifier.fireTestFailure(failure);
            }
View Full Code Here

             
              if (result.failures().hasMoreElements()) {
                failure = new Failure(description, result.failures().nextElement().thrownException());
              }
              else if (result.errors().hasMoreElements()) {
                failure = new Failure(description, result.errors().nextElement().thrownException());
              }
             
              notifier.fireTestFailure(failure);
            }
            else {
View Full Code Here

            if (m_failures.size() > 0) {
                System.out.println("\nTests in error:");
                for (int i = 0; i < m_errors.size(); i++) {
                    TestResult tr = (TestResult) m_errors.get(i);
                    Enumeration e = tr.errors();
                    while (e.hasMoreElements()) {
                        TestFailure tf = (TestFailure) e.nextElement();
                        System.out.println(" " + tf.toString());
                    }
                }
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

            }
            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

                for (Enumeration <TestFailure> i = result.failures();
                        i.hasMoreElements(); )
                {
                    failed.add(i.nextElement());
                }
                for (Enumeration <TestFailure> i = result.errors();
                        i.hasMoreElements(); )
                {
                    errored.add((TestFailure) i.nextElement());
                }
            }
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.