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


                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

    @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

    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

    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

           
            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

  @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

        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

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