Package junit.framework

Examples of junit.framework.TestCase


  }
  public void startTest(Test test) {
    fStartCount++;
  }
  public void testError() {
    TestCase test= new TestCase("noop") {
      @Override
      public void runTest() {
        throw new Error();
      }
    };
    test.run(fResult);
    assertEquals(1, fErrorCount);
    assertEquals(1, fEndCount);
  }
View Full Code Here


    test.run(fResult);
    assertEquals(1, fErrorCount);
    assertEquals(1, fEndCount);
  }
  public void testFailure() {
    TestCase test= new TestCase("noop") {
      @Override
      public void runTest() {
        fail();
      }
    };
    test.run(fResult);
    assertEquals(1, fFailureCount);
    assertEquals(1, fEndCount);
  }
View Full Code Here

    test.run(fResult);
    assertEquals(1, fFailureCount);
    assertEquals(1, fEndCount);
  }
  public void testStartStop() {
    TestCase test= new TestCase("noop") {
      @Override
      public void runTest() {
      }
    };
    test.run(fResult);
    assertEquals(1, fStartCount);
    assertEquals(1, fEndCount);
  }
View Full Code Here

 
  public void testOneTest() {
    String expected= expected(new String[]{".", "Time: 0", "", "OK (1 test)", ""});
    TestSuite suite = new TestSuite();
    suite.addTest(new TestCase() { @Override
    public void runTest() {}});
    runner.doRun(suite);
    assertEquals(expected, output.toString());
  }
View Full Code Here

  }
 
  public void testTwoTests() {
    String expected= expected(new String[]{"..", "Time: 0", "", "OK (2 tests)", ""});
    TestSuite suite = new TestSuite();
    suite.addTest(new TestCase() { @Override
    public void runTest() {}});
    suite.addTest(new TestCase() { @Override
    public void runTest() {}});
    runner.doRun(suite);
    assertEquals(expected, output.toString());
  }
View Full Code Here

        getWriter().println("Failures here");
      }
    };
    runner.setPrinter(printer);
    TestSuite suite = new TestSuite();
    suite.addTest(new TestCase() { @Override
    public void runTest() {throw new AssertionFailedError();}});
    runner.doRun(suite);
    assertEquals(expected, output.toString());
  }
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();}});
    runner.doRun(suite);
    assertEquals(expected, output.toString());
  }
View Full Code Here

    // writing self tests. And you thought those weird anonymous
    // inner classes were bad...
    assertEquals("testCaseToString(junit.tests.framework.TestCaseTest)", toString());
  }
  public void testError() {
    TestCase error= new TestCase("error") {
      @Override
      protected void runTest() {
        throw new Error();
      }
    };
View Full Code Here

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

      }
    };
    verifyError(fails);
  }
  public void testSuccess() {
    TestCase success= new TestCase("success") {
      @Override
      protected void runTest() {
      }
    };
    verifySuccess(success);
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.