Package junit.framework

Examples of junit.framework.TestResult


      public void setUp() {
        fail();
      }
    };

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

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


  protected void createMenus(MenuBar mb) {
    mb.add(createJUnitMenu());
  }
  protected TestResult createTestResult() {
    return new TestResult();
  }
View Full Code Here

      reloadedTest= TestSuite.createTest(reloadedTestClass, rerunTest.getName());
    } catch(Exception e) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    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 testCompatibility() {
    fLog= "";
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(NewTest.class);
    adapter.run(result);
    assertEquals("before test after ", fLog);
  }
View Full Code Here

    @Test public void error() throws Exception {
      throw exception;
    }
  }
  public void testException() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(ErrorTest.class);
    adapter.run(result);
    assertEquals(exception, result.errors().nextElement().thrownException());
  }
View Full Code Here

    assertEquals(exception, result.errors().nextElement().thrownException());
  }
 
  public void testNotifyResult() {
    JUnit4TestAdapter adapter= new JUnit4TestAdapter(ErrorTest.class);
    TestResult result= new TestResult();
    final StringBuffer log= new StringBuffer();
    result.addListener(new TestListener() {
   
      public void startTest(junit.framework.Test test) {
        log.append(" start " + test);
      }
   
View Full Code Here

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

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

    }
  }
 
  public void testBeforeAndAfterClass() {
    log= "";
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(BeforeClassTest.class);
    adapter.run(result);
    assertEquals("before class before test after before test after after class ", log);
  }
View Full Code Here

    @Test public void nothing() {
    }
  }
 
  public void testExceptionInBefore() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(ExceptionInBeforeTest.class);
    adapter.run(result);
    assertEquals(1, result.errorCount());
  }
View Full Code Here

TOP

Related Classes of junit.framework.TestResult

Copyright © 2018 www.massapicom. 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.