Package junit.framework

Examples of junit.framework.TestResult.wasSuccessful()


        TestResult result = new TestResult();
       
       
        suite.run(result);
       
        if (result.wasSuccessful()) {
           
            logger.info("Success");
        } else {
            logger.severe("Failed");
           
View Full Code Here


        }
      }
    ));
    try {
      TestResult result= junit.textui.TestRunner.run(new TestSuite());
      assertTrue(result.wasSuccessful());
    } finally {
      System.setOut(oldOut);
    }
  }
   
View Full Code Here

 
  public void testExceptionSubclass() {
    ExceptionTestCase test= new ThrowExceptionTestCase("test", IndexOutOfBoundsException.class);
    TestResult result= test.run();
    assertEquals(1, result.runCount());
    assertTrue(result.wasSuccessful());
  }
  public void testExceptionTest() {
    ExceptionTestCase test= new ThrowExceptionTestCase("test", IndexOutOfBoundsException.class);
    TestResult result= test.run();
    assertEquals(1, result.runCount());
View Full Code Here

  }
  public void testExceptionTest() {
    ExceptionTestCase test= new ThrowExceptionTestCase("test", IndexOutOfBoundsException.class);
    TestResult result= test.run();
    assertEquals(1, result.runCount());
    assertTrue(result.wasSuccessful());
  }
  public void testFailure() {
    ExceptionTestCase test= new ThrowRuntimeExceptionTestCase("test", IndexOutOfBoundsException.class);
    TestResult result= test.run();
    assertEquals(1, result.runCount());
View Full Code Here

    TestSetup wrapper= new TestSetup(test);

    TestResult result= new TestResult();
    wrapper.run(result);
    assertTrue(!result.wasSuccessful());
  }
  public void testRunningErrorsInTestSetup() {
    TestCase failure= new TestCase("failure") {
      @Override
      public void runTest() {
View Full Code Here

    TestResult result= new TestResult();
    wrapper.run(result);

    assertTrue(!test.fWasRun);
    assertTrue(!result.wasSuccessful());
  }
}
View Full Code Here

    }
    TestResult result= new TestResult();
    reloadedTest.run(result);

    String message= reloadedTest.toString();
    if(result.wasSuccessful())
      showInfo(message+" was successful");
    else if (result.errorCount() == 1)
      showStatus(message+" had an error");
    else
      showStatus(message+" had a failure");
View Full Code Here

  }
  public void testNoException() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(NoExceptionTest.class);
    adapter.run(result);
    assertFalse(result.wasSuccessful());
  }
 
  public static class ExpectedTest {
    @Test(expected= Exception.class) public void expected() throws Exception {
      throw new Exception();
View Full Code Here

  }
  public void testExpected() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(ExpectedTest.class);
    adapter.run(result);
    assertTrue(result.wasSuccessful());
  }
 
  public static class UnExpectedExceptionTest {
    @Test(expected= Exception.class) public void expected() throws Exception {
      throw new Error();
View Full Code Here

    }
    TestResult result= new TestResult();
    reloadedTest.run(result);

    String message= reloadedTest.toString();
    if(result.wasSuccessful())
      showInfo(message+" was successful");
    else if (result.errorCount() == 1)
      showStatus(message+" had an error");
    else
      showStatus(message+" had a failure");
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.