Package junit.framework

Examples of junit.framework.TestCase


      }
    };
    verifySuccess(success);
  }
  public void testFailure() {
    TestCase failure= new TestCase("failure") {
      @Override
      protected void runTest() {
        fail();
      }
    };
View Full Code Here


    verifyError(fails);
    assertTrue(fails.fTornDown);
  }
 
  public void testTearDownFails() {
    TestCase fails= new TestCase("success") {
      @Override
      protected void tearDown() {
        throw new Error();
      }
      @Override
View Full Code Here

    assertEquals("running", failure.thrownException().getMessage());
  }
 
  public void testErrorTearingDownDoesntMaskErrorRunning() {
    final Exception running= new Exception("Running");
    TestCase t= new TestCase() {
      @Override
      protected void runTest() throws Throwable {
        throw running;
      }
      @Override
      protected void tearDown() throws Exception {
        throw new Error("Tearing down");
      }
    };
    try {
      t.runBare();
    } catch (Throwable thrown) {
      assertSame(running, thrown);
    }
  }
View Full Code Here

    assertTrue(result.failureCount() == 0);
    assertTrue(result.errorCount() == 0);
  }
 
  public void testNamelessTestCase() {
    TestCase t= new TestCase() {};
    TestResult result = t.run();
    assertEquals(1, result.failureCount());
  }
View Full Code Here

  }
 
  private DoubleTestCase fTest;
 
  public TestImplementorTest() {
    TestCase testCase= new TestCase() {
      @Override
      public void runTest() {
      }
    };
    fTest= new DoubleTestCase(testCase);
View Full Code Here

    protected void tearDown() {
      fTornDown= true;
    }
  }
  public void testRunningErrorInTestSetup() {
    TestCase test= new TestCase("failure") {
      @Override
      public void runTest() {
        fail();
      }
    };
View Full Code Here

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

    TestCase error= new TestCase("error") {
      @Override
      public void runTest() {
        throw new Error();
      }
    };
View Full Code Here

    if (!(test instanceof TestCase)) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    Test reloadedTest= null;
    TestCase rerunTest= (TestCase)test;
    try {
      Class reloadedTestClass= getLoader().reload(test.getClass());
      reloadedTest= TestSuite.createTest(reloadedTestClass, rerunTest.getName());
    } catch(Exception e) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    TestResult result= new TestResult();
View Full Code Here

    if (!(test instanceof TestCase)) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    Test reloadedTest= null;
    TestCase rerunTest= (TestCase)test;

    try {
      Class reloadedTestClass= getLoader().reload(test.getClass());
      reloadedTest= TestSuite.createTest(reloadedTestClass, rerunTest.getName());
    } catch(Exception e) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    TestResult result= new TestResult();
View Full Code Here

        getWriter().println("Errors here");
      }
    };
    runner.setPrinter(printer);
    TestSuite suite= new TestSuite();
    suite.addTest(new TestCase() {
      @Override
      public void runTest() throws Exception {
        throw new Exception();
      }
    });
View Full Code Here

TOP

Related Classes of junit.framework.TestCase

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.