Examples of errors()


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

Examples of junit.framework.TestResult.errors()

            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

Examples of junit.framework.TestResult.errors()

           
            logger.info("Success");
        } else {
            logger.severe("Failed");
           
            Enumeration errorEnum = result.errors();
            TestFailure failure = null;
            while (errorEnum.hasMoreElements()) {
                failure = (TestFailure) errorEnum.nextElement();
                logger.severe("Test " + failure.failedTest().toString() + " failed --------");
                Throwable th = failure.thrownException();
View Full Code Here

Examples of junit.framework.TestResult.errors()

  @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

Examples of junit.framework.TestResult.errors()

        throw new Error("tearingDown");
      }
    };
    TestResult result= new TestResult();
    t.run(result);
    TestFailure failure= result.errors().nextElement();
    assertEquals("running", failure.thrownException().getMessage());
  }
 
  public void testErrorTearingDownDoesntMaskErrorRunning() {
    final Exception running= new Exception("Running");
View Full Code Here

Examples of junit.framework.TestResult.errors()

  }
  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

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

Examples of junit.framework.TestResult.errors()

           
            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

Examples of junit.framework.TestResult.errors()

        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

Examples of junit.framework.TestResult.errors()

        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
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.