You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(80) |
Nov
(42) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(11) |
Feb
(50) |
Mar
(70) |
Apr
(102) |
May
(28) |
Jun
(45) |
Jul
(14) |
Aug
(75) |
Sep
(17) |
Oct
(15) |
Nov
(11) |
Dec
(4) |
2003 |
Jan
(16) |
Feb
(19) |
Mar
(21) |
Apr
(20) |
May
(29) |
Jun
(7) |
Jul
(5) |
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(3) |
2004 |
Jan
(5) |
Feb
(4) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(6) |
Oct
(6) |
Nov
(1) |
Dec
(2) |
2005 |
Jan
(4) |
Feb
(4) |
Mar
(15) |
Apr
(1) |
May
|
Jun
(4) |
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(4) |
2006 |
Jan
|
Feb
(91) |
Mar
(47) |
Apr
(7) |
May
(4) |
Jun
(9) |
Jul
(1) |
Aug
|
Sep
(5) |
Oct
(36) |
Nov
(95) |
Dec
(12) |
2007 |
Jan
(11) |
Feb
(31) |
Mar
(45) |
Apr
(11) |
May
(9) |
Jun
(1) |
Jul
(146) |
Aug
(15) |
Sep
|
Oct
(3) |
Nov
(6) |
Dec
(1) |
2008 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(2) |
Aug
(19) |
Sep
(1) |
Oct
(10) |
Nov
|
Dec
(8) |
2009 |
Jan
(3) |
Feb
(1) |
Mar
(4) |
Apr
(8) |
May
(5) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
(13) |
Nov
(13) |
Dec
(4) |
2010 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(2) |
May
|
Jun
(1) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
(1) |
Feb
(4) |
Mar
(3) |
Apr
(4) |
May
|
Jun
(12) |
Jul
(16) |
Aug
(4) |
Sep
(7) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
From: Guru P. <apr...@gm...> - 2006-02-17 07:44:10
|
Lalitha krishnamurthy wrote: please let me know how to unsubscribe from the mailing list. Thanks Goto https://lists.sourceforge.net/lists/listinfo/junit-devel and unsubscribe. -- Guru prasath http://guruprasath.blogspot.com |
From: Lalitha k. <lal...@ya...> - 2006-02-16 21:46:40
|
please let me know how to unsubscribe from the mailing list. Thanks --------------------------------- What are the most popular cars? Find out at Yahoo! Autos |
From: David S. <ds...@us...> - 2006-02-15 22:56:21
|
Update of /cvsroot/junit/junit/doc/cookbook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/doc/cookbook Modified Files: cookbook.htm Removed Files: IMG00001.GIF Log Message: Merged with branch, Kent will make final changes and launch. Index: cookbook.htm =================================================================== RCS file: /cvsroot/junit/junit/doc/cookbook/cookbook.htm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- cookbook.htm 31 Aug 2002 12:47:58 -0000 1.6 +++ cookbook.htm 15 Feb 2006 22:55:38 -0000 1.7 @@ -33,19 +33,16 @@ here is what you do: <ol> <li> -Create a subclass of <a href="../../javadoc/junit/framework/TestCase.html">TestCase</a>.</li> - -<li> -Override the method <tt>runTest</tt>()</li> +Annotate a method with @org.junit.Test <li> -When you want to check a value, call <tt>assertTrue</tt>() and pass a boolean +When you want to check a value, import org.junit.Assert.* statically, call <tt>assertTrue</tt>() and pass a boolean that is true if the test succeeds</li> </ol> For example, to test that the sum of two Moneys with the same currency contains a value which is the sum of the values of the two Moneys, write: <blockquote> -<pre><tt>public void testSimpleAdd() { +<pre><tt>@Test public void simpleAdd() { Money m12CHF= new Money(12, "CHF"); Money m14CHF= new Money(14, "CHF"); Money expected= new Money(26, "CHF"); @@ -54,7 +51,7 @@ }</tt></pre> </blockquote> If you want to write a test similar to one you have already written, write -a Fixture instead. When you want to run more than one test, create a Suite. +a Fixture instead. <h2> Fixture</h2> What if you have two or more tests that operate on the same or similar @@ -71,187 +68,69 @@ results. <p>When you have a common fixture, here is what you do: <ol> -<li> -Create a subclass of TestCase</li> <li> -Add an instance variable for each part of the fixture</li> +Add a field for each part of the fixture</li> <li> -Override <a href="../../javadoc/junit/framework/TestCase.html#setUp()">setUp</a>() -to initialize the variables</li> +Annotate a method with @org.junit.Before +and initialize the variables in that method</li> <li> -Override <a href="../../javadoc/junit/framework/TestCase.html#tearDown()">tearDown</a>() +Annotate a method with @org.junit.After to release any permanent resources you allocated in setUp</li> </ol> For example, to write several test cases that want to work with different combinations of 12 Swiss Francs, 14 Swiss Francs, and 28 US Dollars, first create a fixture: -<pre><tt>public class MoneyTest extends TestCase { +<pre><tt>public class MoneyTest { private Money f12CHF; private Money f14CHF; private Money f28USD; - protected void setUp() { + @Before public void setUp() { f12CHF= new Money(12, "CHF"); f14CHF= new Money(14, "CHF"); f28USD= new Money(28, "USD"); } }</tt></pre> Once you have the Fixture in place, you can write as many Test Cases as -you'd like. -<h2> -Test Case</h2> -How do you write and invoke an individual test case when you have a Fixture? -<p>Writing a test case without a fixture is simple- override <b><tt><font face="Courier">runTest</font></tt></b> -in an anonymous subclass of TestCase. You write test cases for a Fixture -the same way, by making a subclass of TestCase for your set up code and -then making anonymous subclasses for the individual test cases. However, -after a few such tests you would notice that a large percentage of your -lines of code are sacrificed to syntax. -<p>JUnit provides a more concise way to write a test against a Fixture. -Here is what you do: -<ol> -<li> -Write a public void method in the fixture class. By convention, the name of the -method begins with "test".</li> - -</ol> -For example, to test the addition of a Money and a MoneyBag, write: -<blockquote> -<pre><tt>public void testMoneyMoneyBag() { - // [12 CHF] + [14 CHF] + [28 USD] == {[26 CHF][28 USD]} - Money bag[]= { f26CHF, f28USD }; - MoneyBag expected= new MoneyBag(bag); - assertEquals(expected, f12CHF.add(f28USD.add(f14CHF))); -}</tt></pre> -</blockquote> -Create an instance of of MoneyTest that will run this test case like this: -<blockquote> -<pre><tt>new MoneyTest("testMoneyMoneyBag")</tt></pre> -</blockquote> -When the test is run, the name of the test is used to look up the method -to run. -<p>Once you have several tests, organize them into a Suite. -<h2> -Suite</h2> -How do you run several tests at once? -<p>As soon as you have two tests, you'll want to run them together. You -could run the tests one at a time yourself, but you would quickly grow -tired of that. Instead, JUnit provides an object, <a href="../../javadoc/junit/framework/TestSuite.html">TestSuite</a> -which runs any number of test cases together. -<p>For example, to run a single test case, you execute: -<blockquote> -<pre><tt>TestResult result= (new MoneyTest("testMoneyMoneyBag")).run();</tt></pre> -</blockquote> -To create a suite of two test cases and run them together, execute: -<blockquote> -<pre><tt>TestSuite suite= new TestSuite(); -suite.addTest(new MoneyTest("testMoneyEquals")); -suite.addTest(new MoneyTest("testSimpleAdd")); -TestResult result= suite.run();</tt></pre> -</blockquote> -Another way is to let JUnit extract a suite from a TestCase. To do so you -pass the class of your TestCase to the -<br>TestSuite constructor. -<blockquote> -<pre><tt>TestSuite suite= new TestSuite(MoneyTest.class);</tt> -<tt>TestResult result= suite.run();</tt></pre> -</blockquote> -<p>Use the manual way when you want a suite to only contain a subset of -the test cases. Otherwise the automatic suite extraction is the preferred -way. It avoids you having to update the suite creation code when you add -a new test case. -<p>TestSuites don't only have to contain TestCases. They contain any object -that implements the <a href="../../javadoc/junit/framework/Test.html">Test</a> -interface. For example, you can create a TestSuite in your code and I can -create one in mine, and we can run them together by creating a TestSuite -that contains both: -<blockquote> -<pre><tt>TestSuite suite= new TestSuite(); -</tt>suite.addTest(Kent.suite()); -suite.addTest(Erich.suite()); -TestResult result= suite.run();</pre> - -</blockquote> - +you'd like. Add as many test methods (annotated with @Test) as you'd like. <h2> TestRunner</h2> How do you run your tests and collect their results? -<p>Once you have a test suite, you'll want to run it. JUnit provides tools -to define the suite to be run and to display its results. You make your -suite accessible to a TestRunner tool with a static method <i>suite</i> -that returns a test suite. -<br>For example, to make a MoneyTest suite available to a TestRunner, add -the following code to MoneyTest: +<p>Once you have tests, you'll want to run them. JUnit provides tools +to define the suite to be run and to display its results. To run tests and see the +results on the console, run: <blockquote> -<pre><tt>public static Test suite() { - TestSuite suite= new TestSuite(); - suite.addTest(new MoneyTest("testMoneyEquals")); - suite.addTest(new MoneyTest("testSimpleAdd")); - return suite; -}</tt></pre> +<pre><tt>org.junit.runner.TextListener.run(TestClass1.class, ...); +</tt></pre> </blockquote> -Or, as a shortcut: +You make your JUnit 4 test classes accessible to a TestRunner designed to work with earlier versions of JUnit, +declare a static method <i>suite</i> +that returns a test. <blockquote> -<pre><tt>public static Test suite() { - return new TestSuite(MoneyTest.class); +<pre><tt>public static junit.framework.Test suite() { + return new JUnit4TestAdapter(Example.class); }</tt></pre> </blockquote> -<p>If a TestCase class doesn't define a suite method a TestRunner will extract -a suite and fill it with all the methods starting with "test".</p> -<p>JUnit provides both a graphical and a textual version of a TestRunner -tool. Start it by typing <tt>java</tt> <tt><a href="http://www.junit.org/junit/javadoc/3.8/junit/awtui/TestRunner.html">junit.awtui.TestRunner</a> -or <a href="http://www.junit.org/junit/javadoc/3.8/junit/swingui/TestRunner.html">junit.swingui.TestRunner</a></tt>. -The graphical user interface presents a window with: -<ul> -<li> -a field to type in the name of a class with a suite method,</li> - -<li> -a Run button to start the test,</li> - -<li> -a progress indicator that turns from green to red in the case of a failed -test,</li> - -<li> -a list of failed tests.</li> -</ul> -In the case of an unsuccessful test JUnit reports the failed tests in a -list at the bottom. JUnit distinguishes between <i>failures</i> and <i>errors</i>. -A failure is anticipated and checked for with assertions. Errors are unanticipated -problems like an <i>ArrayIndexOutOfBoundsException</i>. The following figure -shows an example of a failed test. -<center><img SRC="IMG00001.GIF" ></center> - -<p><br> -<p>You have to restart the graphical interface each time you change the code. This -is tedious and time consuming. As an alternative JUnit's AWT and Swing UIs use -<a href="http://www.junit.org/junit/javadoc/3.8/junit/runner/LoadingTestCollector.html">junit.runner.LoadingTestCollector -</a>. -This LoadingTestCollector reloads all your classes for each test run. This feature can -be disabled by unchecking the 'Reload classes every run' checkbox. The most -common JUnit problem is that many packages want to use their own class loader. -Include such packages in excluded.properties. See the <a href="../faq/faq.htm">FAQ</a> -for details. -<p>There is a batch interface to JUnit, also. To use it type<tt>java <a href="http://www.junit.org/junit/javadoc/3.8/junit/textui/TestRunner.html">junit.textui.TestRunner</a></tt> -followed by the name of the class with a suite method at an operating system -prompt. The batch interface shows the result as text output. An alternative -way to invoke the batch interface is to define a main method in your TestCase -class. -<p>For example, to start the batch TestRunner for MoneyTest, write: +<h2> +Expected Exceptions</h2> +How do you verify that code throws exceptions as expected? +<p>Verifying that code completes normally is only part of programming. Making sure the code +behaves as expected in exceptional situations is part of the craft of programming too. For example: <blockquote> -<pre><tt>public static void main(String args[]) { - junit.textui.TestRunner.run(suite()); +<pre><tt>new ArrayList<Object>().get(0); +</tt></pre> +</blockquote> +This code should throw an IndexOutOfBoundsException. The @Test annotation has an optional parameter "expected" +that takes as values subclasses of Throwable. If we wanted to verify that ArrayList throws the correct exception, +we would write: +<blockquote> +<pre><tt>@Test(expected= IndexOutOfBoundsException.class) public void empty() { + new ArrayList<Object>().get(0); }</tt></pre> </blockquote> -With this definition of main you can run your tests by simply typing <tt>java -MoneyTest at an operating system prompt.</tt> -<p>For using either the graphical or the textual version make sure that -the junit.jar file is on your CLASSPATH. -<br> <hr WIDTH="100%"> </body> </html> --- IMG00001.GIF DELETED --- |
From: David S. <ds...@us...> - 2006-02-15 22:56:20
|
Update of /cvsroot/junit/junit/doc/cookstour In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/doc/cookstour Modified Files: cookstour.htm Log Message: Merged with branch, Kent will make final changes and launch. Index: cookstour.htm =================================================================== RCS file: /cvsroot/junit/junit/doc/cookstour/cookstour.htm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cookstour.htm 20 Dec 2003 18:30:46 -0000 1.2 +++ cookstour.htm 15 Feb 2006 22:55:38 -0000 1.3 @@ -660,7 +660,7 @@ rewarded) for our monomania by a continuous flow of insights into JUnit, testing, object design, framework development, and opportunities for further articles.</font></ul> -<font size=-1>The latest version of JUnit can be downloaded from ftp://www.armaties.com/D/home/armaties/ftp/TestingFramework/JUnit/.</font> +<font size=-1>The latest version of JUnit can be downloaded from http://www.junit.org.</font> <p><b><font face="Arial"><font size=+1>5. Acknowledgements</font></font></b> <p><font size=-1>Thanks to John Vlissides, Ralph Johnson, and Nick Edgar for careful reading and gentle correction.</font> |
From: David S. <ds...@us...> - 2006-02-15 22:56:19
|
Update of /cvsroot/junit/junit/org/junit/runner/manipulation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/runner/manipulation Added Files: Sortable.java Sorter.java Filterable.java Filter.java NoTestsRemainException.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:19
|
Update of /cvsroot/junit/junit/junit/textui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/textui Modified Files: TestRunner.java ResultPrinter.java Log Message: Merged with branch, Kent will make final changes and launch. Index: TestRunner.java =================================================================== RCS file: /cvsroot/junit/junit/junit/textui/TestRunner.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- TestRunner.java 13 Nov 2004 00:33:19 -0000 1.22 +++ TestRunner.java 15 Feb 2006 22:55:37 -0000 1.23 @@ -4,11 +4,10 @@ import java.io.PrintStream; import junit.framework.Test; +import junit.framework.TestCase; import junit.framework.TestResult; import junit.framework.TestSuite; import junit.runner.BaseTestRunner; -import junit.runner.StandardTestSuiteLoader; -import junit.runner.TestSuiteLoader; import junit.runner.Version; /** @@ -58,7 +57,7 @@ /** * Runs a suite extracted from a TestCase subclass. */ - static public void run(Class testClass) { + static public void run(Class<? extends TestCase> testClass) { run(new TestSuite(testClass)); } @@ -86,20 +85,15 @@ aTestRunner.doRun(suite, true); } - /** - * Always use the StandardTestSuiteLoader. Overridden from - * BaseTestRunner. - */ - public TestSuiteLoader getLoader() { - return new StandardTestSuiteLoader(); - } - + @Override public void testFailed(int status, Test test, Throwable t) { } + @Override public void testStarted(String testName) { } + @Override public void testEnded(String testName) { } @@ -189,11 +183,12 @@ } protected TestResult runSingleMethod(String testCase, String method, boolean wait) throws Exception { - Class testClass= loadSuiteClass(testCase); + Class<? extends TestCase> testClass= loadSuiteClass(testCase); Test test= TestSuite.createTest(testClass, method); return doRun(test, wait); } + @Override protected void runFailed(String message) { System.err.println(message); System.exit(FAILURE_EXIT); Index: ResultPrinter.java =================================================================== RCS file: /cvsroot/junit/junit/junit/textui/ResultPrinter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ResultPrinter.java 23 Aug 2002 05:05:56 -0000 1.6 +++ ResultPrinter.java 15 Feb 2006 22:55:37 -0000 1.7 @@ -4,7 +4,6 @@ import java.io.PrintStream; import java.text.NumberFormat; import java.util.Enumeration; - import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestFailure; @@ -51,14 +50,14 @@ printDefects(result.failures(), result.failureCount(), "failure"); } - protected void printDefects(Enumeration booBoos, int count, String type) { + protected void printDefects(Enumeration<TestFailure> booBoos, int count, String type) { if (count == 0) return; if (count == 1) getWriter().println("There was " + count + " " + type + ":"); else getWriter().println("There were " + count + " " + type + "s:"); for (int i= 1; booBoos.hasMoreElements(); i++) { - printDefect((TestFailure) booBoos.nextElement(), i); + printDefect(booBoos.nextElement(), i); } } |
From: David S. <ds...@us...> - 2006-02-15 22:56:19
|
Update of /cvsroot/junit/junit/org/junit/internal/requests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/internal/requests Added Files: ClassRequest.java FilterRequest.java ErrorReportingRequest.java ClassesRequest.java SortingRequest.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:16
|
Update of /cvsroot/junit/junit/junit/tests/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/tests/extensions Modified Files: ExtensionTest.java RepeatedTestTest.java AllTests.java ActiveTestTest.java Removed Files: ExceptionTestCaseTest.java Log Message: Merged with branch, Kent will make final changes and launch. Index: ExtensionTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/extensions/ExtensionTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ExtensionTest.java 9 Sep 2004 21:53:57 -0000 1.3 +++ ExtensionTest.java 15 Feb 2006 22:55:37 -0000 1.4 @@ -18,12 +18,14 @@ TornDown(Test test) { super(test); } + @Override protected void tearDown() { fTornDown= true; } } public void testRunningErrorInTestSetup() { TestCase test= new TestCase("failure") { + @Override public void runTest() { fail(); } @@ -37,12 +39,14 @@ } 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(); } @@ -64,6 +68,7 @@ WasRun test= new WasRun(); TornDown wrapper= new TornDown(test) { + @Override public void setUp() { fail(); } @@ -78,6 +83,7 @@ WasRun test= new WasRun(); TestSetup wrapper= new TestSetup(test) { + @Override public void setUp() { fail(); } Index: RepeatedTestTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/extensions/RepeatedTestTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- RepeatedTestTest.java 9 Sep 2004 21:53:57 -0000 1.4 +++ RepeatedTestTest.java 15 Feb 2006 22:55:37 -0000 1.5 @@ -15,6 +15,7 @@ public static class SuccessTest extends TestCase { + @Override public void runTest() { } } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/extensions/AllTests.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AllTests.java 9 Sep 2004 21:53:57 -0000 1.2 +++ AllTests.java 15 Feb 2006 22:55:37 -0000 1.3 @@ -16,7 +16,6 @@ public static Test suite() { // Collect tests manually because we have to test class collection code TestSuite suite= new TestSuite("Framework Tests"); suite.addTestSuite(ExtensionTest.class); - suite.addTestSuite(ExceptionTestCaseTest.class); suite.addTestSuite(ActiveTestTest.class); suite.addTestSuite(RepeatedTestTest.class); return suite; Index: ActiveTestTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/extensions/ActiveTestTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ActiveTestTest.java 9 Sep 2004 21:53:56 -0000 1.3 +++ ActiveTestTest.java 15 Feb 2006 22:55:37 -0000 1.4 @@ -13,6 +13,7 @@ public class ActiveTestTest extends TestCase { public static class SuccessTest extends TestCase { + @Override public void runTest() { } } --- ExceptionTestCaseTest.java DELETED --- |
From: David S. <ds...@us...> - 2006-02-15 22:56:15
|
Update of /cvsroot/junit/junit/junit/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/framework Modified Files: TestSuite.java TestFailure.java TestResult.java TestCase.java ComparisonFailure.java AssertionFailedError.java Assert.java Added Files: JUnit4TestCaseFacade.java JUnit4TestAdapter.java JUnit4TestAdapterCache.java Log Message: Merged with branch, Kent will make final changes and launch. Index: TestSuite.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/TestSuite.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- TestSuite.java 23 Oct 2004 22:05:36 -0000 1.15 +++ TestSuite.java 15 Feb 2006 22:55:32 -0000 1.16 @@ -6,7 +6,9 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.util.ArrayList; import java.util.Enumeration; +import java.util.List; import java.util.Vector; /** @@ -41,8 +43,8 @@ * ...as the moon sets over the early morning Merlin, Oregon * mountains, our intrepid adventurers type... */ - static public Test createTest(Class theClass, String name) { - Constructor constructor; + static public Test createTest(Class<? extends TestCase> theClass, String name) { + Constructor<? extends TestCase> constructor; try { constructor= getTestConstructor(theClass); } catch (NoSuchMethodException e) { @@ -71,7 +73,7 @@ * Gets a constructor which takes a single String as * its argument or a no arg constructor. */ - public static Constructor getTestConstructor(Class theClass) throws NoSuchMethodException { + public static Constructor<? extends TestCase> getTestConstructor(Class<? extends TestCase> theClass) throws NoSuchMethodException { Class[] args= { String.class }; try { return theClass.getConstructor(args); @@ -86,6 +88,7 @@ */ public static Test warning(final String message) { return new TestCase("warning") { + @Override protected void runTest() { fail(message); } @@ -100,11 +103,11 @@ PrintWriter writer= new PrintWriter(stringWriter); t.printStackTrace(writer); return stringWriter.toString(); - } + private String fName; - private Vector fTests= new Vector(10); + private Vector<Test> fTests= new Vector<Test>(10); // Cannot convert this to List because it is used directly by some test runners /** * Constructs an empty TestSuite. @@ -115,10 +118,10 @@ /** * Constructs a TestSuite from the given class. Adds all the methods * starting with "test" as test cases to the suite. - * Parts of this method was written at 2337 meters in the Hueffihuette, + * Parts of this method were written at 2337 meters in the Hueffihuette, * Kanton Uri */ - public TestSuite(final Class theClass) { + public TestSuite(final Class<? extends TestCase> theClass) { fName= theClass.getName(); try { getTestConstructor(theClass); // Avoid generating multiple error messages @@ -133,12 +136,10 @@ } Class superClass= theClass; - Vector names= new Vector(); + List<String> names= new ArrayList<String>(); while (Test.class.isAssignableFrom(superClass)) { - Method[] methods= superClass.getDeclaredMethods(); - for (int i= 0; i < methods.length; i++) { - addTestMethod(methods[i], names, theClass); - } + for (Method each : superClass.getDeclaredMethods()) + addTestMethod(each, names, theClass); superClass= superClass.getSuperclass(); } if (fTests.size() == 0) @@ -149,7 +150,7 @@ * Constructs a TestSuite from the given class with the given name. * @see TestSuite#TestSuite(Class) */ - public TestSuite(Class theClass, String name) { + public TestSuite(Class<? extends TestCase> theClass, String name) { this(theClass); setName(name); } @@ -165,16 +166,16 @@ * Constructs a TestSuite from the given array of classes. * @param classes */ - public TestSuite (Class[] classes) { - for (int i= 0; i < classes.length; i++) - addTest(new TestSuite(classes[i])); + public TestSuite (Class<? extends TestCase>... classes) { + for (Class<? extends TestCase> each : classes) + addTest(new TestSuite(each)); } /** * Constructs a TestSuite from the given array of classes with the given name. * @see TestSuite#TestSuite(Class[]) */ - public TestSuite(Class[] classes, String name) { + public TestSuite(Class<? extends TestCase>[] classes, String name) { this(classes); setName(name); } @@ -183,13 +184,13 @@ * Adds a test to the suite. */ public void addTest(Test test) { - fTests.addElement(test); + fTests.add(test); } /** * Adds the tests from the given class to the suite */ - public void addTestSuite(Class testClass) { + public void addTestSuite(Class<? extends TestCase> testClass) { addTest(new TestSuite(testClass)); } @@ -198,10 +199,8 @@ */ public int countTestCases() { int count= 0; - for (Enumeration e= tests(); e.hasMoreElements(); ) { - Test test= (Test)e.nextElement(); - count= count + test.countTestCases(); - } + for (Test each : fTests) + count+= each.countTestCases(); return count; } @@ -218,11 +217,10 @@ * Runs the tests and collects their result in a TestResult. */ public void run(TestResult result) { - for (Enumeration e= tests(); e.hasMoreElements(); ) { + for (Test each : fTests) { if (result.shouldStop() ) break; - Test test= (Test)e.nextElement(); - runTest(test, result); + runTest(each, result); } } @@ -242,7 +240,7 @@ * Returns the test at the given index */ public Test testAt(int index) { - return (Test)fTests.elementAt(index); + return fTests.get(index); } /** @@ -255,19 +253,20 @@ /** * Returns the tests as an enumeration */ - public Enumeration tests() { + public Enumeration<Test> tests() { return fTests.elements(); } /** */ + @Override public String toString() { if (getName() != null) return getName(); return super.toString(); } - private void addTestMethod(Method m, Vector names, Class theClass) { + private void addTestMethod(Method m, List<String> names, Class<? extends TestCase> theClass) { String name= m.getName(); if (names.contains(name)) return; @@ -276,7 +275,7 @@ addTest(warning("Test method isn't public: "+m.getName())); return; } - names.addElement(name); + names.add(name); addTest(createTest(theClass, name)); } Index: TestFailure.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/TestFailure.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TestFailure.java 22 Jun 2002 00:28:03 -0000 1.3 +++ TestFailure.java 15 Feb 2006 22:55:32 -0000 1.4 @@ -36,6 +36,7 @@ /** * Returns a short description of the failure. */ + @Override public String toString() { StringBuffer buffer= new StringBuffer(); buffer.append(fFailedTest+": "+fThrownException.getMessage()); Index: TestResult.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/TestResult.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- TestResult.java 9 Sep 2004 21:53:54 -0000 1.5 +++ TestResult.java 15 Feb 2006 22:55:32 -0000 1.6 @@ -1,7 +1,9 @@ package junit.framework; +import java.util.ArrayList; +import java.util.Collections; import java.util.Enumeration; -import java.util.Vector; +import java.util.List; /** * A <code>TestResult</code> collects the results of executing @@ -13,16 +15,16 @@ * @see Test */ public class TestResult extends Object { - protected Vector fFailures; - protected Vector fErrors; - protected Vector fListeners; + protected List<TestFailure> fFailures; + protected List<TestFailure> fErrors; + protected List<TestListener> fListeners; protected int fRunTests; private boolean fStop; public TestResult() { - fFailures= new Vector(); - fErrors= new Vector(); - fListeners= new Vector(); + fFailures= new ArrayList<TestFailure>(); + fErrors= new ArrayList<TestFailure>(); + fListeners= new ArrayList<TestListener>(); fRunTests= 0; fStop= false; } @@ -31,46 +33,45 @@ * caused the error. */ public synchronized void addError(Test test, Throwable t) { - fErrors.addElement(new TestFailure(test, t)); - for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) { - ((TestListener)e.nextElement()).addError(test, t); - } + fErrors.add(new TestFailure(test, t)); + for (TestListener each : cloneListeners()) + each.addError(test, t); } /** * Adds a failure to the list of failures. The passed in exception * caused the failure. */ public synchronized void addFailure(Test test, AssertionFailedError t) { - fFailures.addElement(new TestFailure(test, t)); - for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) { - ((TestListener)e.nextElement()).addFailure(test, t); - } + fFailures.add(new TestFailure(test, t)); + for (TestListener each : cloneListeners()) + each.addFailure(test, t); } /** * Registers a TestListener */ public synchronized void addListener(TestListener listener) { - fListeners.addElement(listener); + fListeners.add(listener); } /** * Unregisters a TestListener */ public synchronized void removeListener(TestListener listener) { - fListeners.removeElement(listener); + fListeners.remove(listener); } /** * Returns a copy of the listeners. */ - private synchronized Vector cloneListeners() { - return (Vector)fListeners.clone(); + private synchronized List<TestListener> cloneListeners() { + List<TestListener> result= new ArrayList<TestListener>(); + result.addAll(fListeners); + return result; } /** * Informs the result that a test was completed. */ public void endTest(Test test) { - for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) { - ((TestListener)e.nextElement()).endTest(test); - } + for (TestListener each : cloneListeners()) + each.endTest(test); } /** * Gets the number of detected errors. @@ -81,9 +82,11 @@ /** * Returns an Enumeration for the errors */ - public synchronized Enumeration errors() { - return fErrors.elements(); + public synchronized Enumeration<TestFailure> errors() { + return Collections.enumeration(fErrors); } + + /** * Gets the number of detected failures. */ @@ -93,9 +96,10 @@ /** * Returns an Enumeration for the failures */ - public synchronized Enumeration failures() { - return fFailures.elements(); + public synchronized Enumeration<TestFailure> failures() { + return Collections.enumeration(fFailures); } + /** * Runs a TestCase. */ @@ -147,9 +151,8 @@ synchronized(this) { fRunTests+= count; } - for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) { - ((TestListener)e.nextElement()).startTest(test); - } + for (TestListener each : cloneListeners()) + each.startTest(test); } /** * Marks that the test run should stop. Index: TestCase.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/TestCase.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- TestCase.java 24 Oct 2004 07:37:06 -0000 1.18 +++ TestCase.java 15 Feb 2006 22:55:32 -0000 1.19 @@ -145,7 +145,7 @@ * @exception Throwable if any exception is thrown */ protected void runTest() throws Throwable { - assertNotNull(fName); // Some VMs crash when calling getMethod(null,null); + assertNotNull("TestCase.fName cannot be null", fName); // Some VMs crash when calling getMethod(null,null); Method runMethod= null; try { // use getMethod to get all public inherited @@ -161,7 +161,7 @@ } try { - runMethod.invoke(this, (Object[])new Class[0]); + runMethod.invoke(this); } catch (InvocationTargetException e) { e.fillInStackTrace(); @@ -187,6 +187,7 @@ /** * Returns a string representation of the test case */ + @Override public String toString() { return getName() + "(" + getClass().getName() + ")"; } Index: ComparisonFailure.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/ComparisonFailure.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ComparisonFailure.java 24 Oct 2004 06:41:48 -0000 1.9 +++ ComparisonFailure.java 15 Feb 2006 22:55:32 -0000 1.10 @@ -30,6 +30,7 @@ * * @see java.lang.Throwable#getMessage() */ + @Override public String getMessage() { return new ComparisonCompactor(MAX_CONTEXT_LENGTH, fExpected, fActual).compact(super.getMessage()); } Index: AssertionFailedError.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/AssertionFailedError.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AssertionFailedError.java 11 Sep 2004 13:49:07 -0000 1.2 +++ AssertionFailedError.java 15 Feb 2006 22:55:32 -0000 1.3 @@ -3,13 +3,14 @@ /** * Thrown when an assertion failed. */ -public class AssertionFailedError extends Error { +public class AssertionFailedError extends AssertionError { private static final long serialVersionUID= 1L; - - public AssertionFailedError () { + + public AssertionFailedError() { } - public AssertionFailedError (String message) { - super (message); + + public AssertionFailedError(String message) { + super(message); } } \ No newline at end of file Index: Assert.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/Assert.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Assert.java 17 Nov 2004 22:06:08 -0000 1.21 +++ Assert.java 15 Feb 2006 22:55:32 -0000 1.22 @@ -105,18 +105,15 @@ assertEquals(null, expected, actual, delta); } /** - * Asserts that two floats are equal concerning a delta. If they are not - * an AssertionFailedError is thrown with the given message. If the expected - * value is infinity then the delta value is ignored. + * Asserts that two floats are equal concerning a positive delta. If they + * are not an AssertionFailedError is thrown with the given message. If the + * expected value is infinity then the delta value is ignored. */ static public void assertEquals(String message, float expected, float actual, float delta) { - // handle infinity specially since subtracting to infinite values gives NaN and the - // the following test fails - if (Float.isInfinite(expected)) { - if (!(expected == actual)) + if (Float.compare(expected, actual) == 0) + return; + if (!(Math.abs(expected - actual) <= delta)) failNotEquals(message, new Float(expected), new Float(actual)); - } else if (!(Math.abs(expected-actual) <= delta)) - failNotEquals(message, new Float(expected), new Float(actual)); } /** * Asserts that two floats are equal concerning a delta. If the expected @@ -280,7 +277,7 @@ fail(format(message, expected, actual)); } - static String format(String message, Object expected, Object actual) { + public static String format(String message, Object expected, Object actual) { String formatted= ""; if (message != null) formatted= message+" "; |
From: David S. <ds...@us...> - 2006-02-15 22:56:14
|
Update of /cvsroot/junit/junit/junit/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/extensions Modified Files: RepeatedTest.java TestSetup.java TestDecorator.java ActiveTestSuite.java Removed Files: ExceptionTestCase.java Log Message: Merged with branch, Kent will make final changes and launch. Index: RepeatedTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/extensions/RepeatedTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- RepeatedTest.java 9 Sep 2004 21:53:56 -0000 1.3 +++ RepeatedTest.java 15 Feb 2006 22:55:34 -0000 1.4 @@ -5,9 +5,9 @@ /** * A Decorator that runs a test repeatedly. - * + * */ -public class RepeatedTest extends TestDecorator { +public class RepeatedTest extends TestDecorator { private int fTimesRepeat; public RepeatedTest(Test test, int repeat) { @@ -16,9 +16,13 @@ throw new IllegalArgumentException("Repetition count must be > 0"); fTimesRepeat= repeat; } + + @Override public int countTestCases() { - return super.countTestCases()*fTimesRepeat; + return super.countTestCases() * fTimesRepeat; } + + @Override public void run(TestResult result) { for (int i= 0; i < fTimesRepeat; i++) { if (result.shouldStop()) @@ -26,7 +30,9 @@ super.run(result); } } + + @Override public String toString() { - return super.toString()+"(repeated)"; + return super.toString() + "(repeated)"; } } \ No newline at end of file Index: TestSetup.java =================================================================== RCS file: /cvsroot/junit/junit/junit/extensions/TestSetup.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TestSetup.java 9 Sep 2004 21:53:56 -0000 1.2 +++ TestSetup.java 15 Feb 2006 22:55:34 -0000 1.3 @@ -5,15 +5,17 @@ import junit.framework.TestResult; /** - * A Decorator to set up and tear down additional fixture state. - * Subclass TestSetup and insert it into your tests when you want - * to set up additional state once before the tests are run. + * A Decorator to set up and tear down additional fixture state. Subclass + * TestSetup and insert it into your tests when you want to set up additional + * state once before the tests are run. */ public class TestSetup extends TestDecorator { public TestSetup(Test test) { super(test); } + + @Override public void run(final TestResult result) { Protectable p= new Protectable() { public void protect() throws Exception { @@ -24,15 +26,16 @@ }; result.runProtected(this, p); } + /** - * Sets up the fixture. Override to set up additional fixture - * state. + * Sets up the fixture. Override to set up additional fixture state. */ protected void setUp() throws Exception { } + /** - * Tears down the fixture. Override to tear down the additional - * fixture state. + * Tears down the fixture. Override to tear down the additional fixture + * state. */ protected void tearDown() throws Exception { } Index: TestDecorator.java =================================================================== RCS file: /cvsroot/junit/junit/junit/extensions/TestDecorator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- TestDecorator.java 9 Sep 2004 21:53:56 -0000 1.5 +++ TestDecorator.java 15 Feb 2006 22:55:34 -0000 1.6 @@ -5,11 +5,10 @@ import junit.framework.TestResult; /** - * A Decorator for Tests. Use TestDecorator as the base class - * for defining new test decorators. Test decorator subclasses - * can be introduced to add behaviour before or after a test - * is run. - * + * A Decorator for Tests. Use TestDecorator as the base class for defining new + * test decorators. Test decorator subclasses can be introduced to add behaviour + * before or after a test is run. + * */ public class TestDecorator extends Assert implements Test { protected Test fTest; @@ -17,19 +16,23 @@ public TestDecorator(Test test) { fTest= test; } + /** * The basic run behaviour. */ public void basicRun(TestResult result) { fTest.run(result); } + public int countTestCases() { return fTest.countTestCases(); } + public void run(TestResult result) { basicRun(result); } + @Override public String toString() { return fTest.toString(); } Index: ActiveTestSuite.java =================================================================== RCS file: /cvsroot/junit/junit/junit/extensions/ActiveTestSuite.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ActiveTestSuite.java 24 Oct 2004 07:37:06 -0000 1.6 +++ ActiveTestSuite.java 15 Feb 2006 22:55:34 -0000 1.7 @@ -1,6 +1,7 @@ package junit.extensions; import junit.framework.Test; +import junit.framework.TestCase; import junit.framework.TestResult; import junit.framework.TestSuite; @@ -16,7 +17,7 @@ public ActiveTestSuite() { } - public ActiveTestSuite(Class theClass) { + public ActiveTestSuite(Class<? extends TestCase> theClass) { super(theClass); } @@ -24,18 +25,21 @@ super (name); } - public ActiveTestSuite(Class theClass, String name) { + public ActiveTestSuite(Class<? extends TestCase> theClass, String name) { super(theClass, name); } + @Override public void run(TestResult result) { fActiveTestDeathCount= 0; super.run(result); waitUntilFinished(); } + @Override public void runTest(final Test test, final TestResult result) { Thread t= new Thread() { + @Override public void run() { try { // inlined due to limitation in VA/Java --- ExceptionTestCase.java DELETED --- |
From: David S. <ds...@us...> - 2006-02-15 22:56:14
|
Update of /cvsroot/junit/junit/org/junit/runners In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/runners Added Files: Enclosed.java Suite.java AllTests.java Parameterized.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:14
|
Update of /cvsroot/junit/junit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/doc Added Files: index.htm Removed Files: changes21.html Changes34.html JUnitProperties.html Log Message: Merged with branch, Kent will make final changes and launch. --- changes21.html DELETED --- --- Changes34.html DELETED --- --- JUnitProperties.html DELETED --- |
From: David S. <ds...@us...> - 2006-02-15 22:56:13
|
Update of /cvsroot/junit/junit/junit/tests/runner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/tests/runner Modified Files: StackFilterTest.java BaseTestRunnerTest.java TextRunnerTest.java AllTests.java TextRunnerSingleMethodTest.java TextFeedbackTest.java Removed Files: ClassLoaderTest.java SorterTest.java SimpleTestCollectorTest.java TestCaseClassLoaderTest.java LoadedFromJar.java Log Message: Merged with branch, Kent will make final changes and launch. Index: StackFilterTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/runner/StackFilterTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- StackFilterTest.java 9 Sep 2004 21:53:55 -0000 1.4 +++ StackFilterTest.java 15 Feb 2006 22:55:28 -0000 1.5 @@ -10,6 +10,7 @@ String fFiltered; String fUnfiltered; + @Override protected void setUp() { StringWriter swin= new StringWriter(); PrintWriter pwin= new PrintWriter(swin); Index: BaseTestRunnerTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/runner/BaseTestRunnerTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- BaseTestRunnerTest.java 3 Sep 2004 16:27:28 -0000 1.5 +++ BaseTestRunnerTest.java 15 Feb 2006 22:55:28 -0000 1.6 @@ -8,15 +8,19 @@ public class BaseTestRunnerTest extends TestCase { public static class MockRunner extends BaseTestRunner { + @Override protected void runFailed(String message) { } + @Override public void testEnded(String testName) { } + @Override public void testFailed(int status, Test test, Throwable t) { } + @Override public void testStarted(String testName) { } } Index: TextRunnerTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/runner/TextRunnerTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TextRunnerTest.java 23 Oct 2004 06:47:22 -0000 1.6 +++ TextRunnerTest.java 15 Feb 2006 22:55:28 -0000 1.7 @@ -44,6 +44,7 @@ PrintStream oldOut= System.out; System.setOut(new PrintStream ( new OutputStream() { + @Override public void write(int arg0) throws IOException { } } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/runner/AllTests.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- AllTests.java 17 Nov 2004 22:46:47 -0000 1.6 +++ AllTests.java 15 Feb 2006 22:55:28 -0000 1.7 @@ -2,7 +2,6 @@ import junit.framework.Test; import junit.framework.TestSuite; -import junit.runner.BaseTestRunner; /** * TestSuite that runs all the sample tests @@ -17,16 +16,10 @@ public static Test suite() { // Collect tests manually because we have to test class collection code TestSuite suite= new TestSuite("Framework Tests"); suite.addTestSuite(StackFilterTest.class); - suite.addTestSuite(SorterTest.class); - suite.addTestSuite(SimpleTestCollectorTest.class); suite.addTestSuite(BaseTestRunnerTest.class); suite.addTestSuite(TextFeedbackTest.class); - //suite.addTestSuite(TextRunnerSingleMethodTest.class); - if (!BaseTestRunner.inVAJava()) { - suite.addTestSuite(TextRunnerTest.class); - if (!isJDK11()) - suite.addTest(new TestSuite(TestCaseClassLoaderTest.class)); - } + suite.addTestSuite(TextRunnerSingleMethodTest.class); + suite.addTestSuite(TextRunnerTest.class); return suite; } Index: TextRunnerSingleMethodTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/runner/TextRunnerSingleMethodTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TextRunnerSingleMethodTest.java 17 Nov 2004 22:46:22 -0000 1.3 +++ TextRunnerSingleMethodTest.java 15 Feb 2006 22:55:28 -0000 1.4 @@ -1,54 +1,19 @@ package junit.tests.runner; +import java.io.ByteArrayOutputStream; import java.io.PrintStream; -import java.util.Enumeration; -import junit.framework.*; -import junit.textui.*; + +import junit.framework.TestCase; +import junit.textui.ResultPrinter; +import junit.textui.TestRunner; /** * Test invoking a single test method of a TestCase. */ public class TextRunnerSingleMethodTest extends TestCase { - private final class NullResultPrinter extends ResultPrinter { - private NullResultPrinter(PrintStream writer) { - super(writer); - } - public void addError(Test test, Throwable t) { - } - public void addFailure(Test test, AssertionFailedError t) { - } - protected String elapsedTimeAsString(long runTime) { - return null; - } - public void endTest(Test test) { - } - public PrintStream getWriter() { - return null; - } - synchronized void print(TestResult result, long runTime) { - } - public void printDefect(TestFailure failure, int count) { - } - protected void printDefectHeader(TestFailure failure, int count) { - } - protected void printDefects(Enumeration failure, int count, String type) { - } - protected void printDefectTrace(TestFailure failure) { - } - protected void printErrors(TestResult result) { - } - protected void printFailures(TestResult result) { - } - protected void printFooter(TestResult result) { - } - protected void printHeader(long runTime) { - } - void printWaitPrompt() { - } - public void startTest(Test test) { - } - } - + + static boolean fgWasInvoked; + public static class InvocationTest extends TestCase { public void testWasInvoked() { @@ -59,14 +24,14 @@ fail("Shouldn't get here."); } } - static boolean fgWasInvoked= false; - + public void testSingle() throws Exception { - TestRunner t= new TestRunner(new NullResultPrinter(null)); + TestRunner t= new TestRunner(); + t.setPrinter(new ResultPrinter(new PrintStream(new ByteArrayOutputStream()))); String[] args= { "-m", "junit.tests.runner.TextRunnerSingleMethodTest$InvocationTest.testWasInvoked" }; - assertFalse(fgWasInvoked); + fgWasInvoked= false; t.start(args); assertTrue(fgWasInvoked); } Index: TextFeedbackTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/runner/TextFeedbackTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- TextFeedbackTest.java 23 Oct 2004 05:28:40 -0000 1.10 +++ TextFeedbackTest.java 15 Feb 2006 22:55:28 -0000 1.11 @@ -23,6 +23,7 @@ /* Spoof printing time so the tests are deterministic */ + @Override protected String elapsedTimeAsString(long runTime) { return "0"; } @@ -32,6 +33,7 @@ TestRunner.run(TextFeedbackTest.class); } + @Override public void setUp() { output= new ByteArrayOutputStream(); runner= new TestRunner(new TestResultPrinter(new PrintStream(output))); @@ -47,7 +49,8 @@ public void testOneTest() { String expected= expected(new String[]{".", "Time: 0", "", "OK (1 test)", ""}); TestSuite suite = new TestSuite(); - suite.addTest(new TestCase() { public void runTest() {}}); + suite.addTest(new TestCase() { @Override + public void runTest() {}}); runner.doRun(suite); assertEquals(expected, output.toString()); } @@ -55,8 +58,10 @@ public void testTwoTests() { String expected= expected(new String[]{"..", "Time: 0", "", "OK (2 tests)", ""}); TestSuite suite = new TestSuite(); - suite.addTest(new TestCase() { public void runTest() {}}); - suite.addTest(new TestCase() { public void runTest() {}}); + suite.addTest(new TestCase() { @Override + public void runTest() {}}); + suite.addTest(new TestCase() { @Override + public void runTest() {}}); runner.doRun(suite); assertEquals(expected, output.toString()); } @@ -64,13 +69,15 @@ public void testFailure() { String expected= expected(new String[]{".F", "Time: 0", "Failures here", "", "FAILURES!!!", "Tests run: 1, Failures: 1, Errors: 0", ""}); ResultPrinter printer= new TestResultPrinter(new PrintStream(output)) { + @Override public void printFailures(TestResult result) { getWriter().println("Failures here"); } }; runner.setPrinter(printer); TestSuite suite = new TestSuite(); - suite.addTest(new TestCase() { public void runTest() {throw new AssertionFailedError();}}); + suite.addTest(new TestCase() { @Override + public void runTest() {throw new AssertionFailedError();}}); runner.doRun(suite); assertEquals(expected, output.toString()); } @@ -78,13 +85,15 @@ public void testError() { String expected= expected(new String[]{".E", "Time: 0", "Errors here", "", "FAILURES!!!", "Tests run: 1, Failures: 0, Errors: 1", ""}); ResultPrinter printer= new TestResultPrinter(new PrintStream(output)) { + @Override public void printErrors(TestResult result) { getWriter().println("Errors here"); } }; runner.setPrinter(printer); TestSuite suite = new TestSuite(); - suite.addTest(new TestCase() { public void runTest() throws Exception {throw new Exception();}}); + suite.addTest(new TestCase() { @Override + public void runTest() throws Exception {throw new Exception();}}); runner.doRun(suite); assertEquals(expected, output.toString()); } --- ClassLoaderTest.java DELETED --- --- SorterTest.java DELETED --- --- SimpleTestCollectorTest.java DELETED --- --- TestCaseClassLoaderTest.java DELETED --- --- LoadedFromJar.java DELETED --- |
From: David S. <ds...@us...> - 2006-02-15 22:56:13
|
Update of /cvsroot/junit/junit/junit/runner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/runner Modified Files: BaseTestRunner.java Version.java Removed Files: FailureDetailView.java ReloadingTestSuiteLoader.java TestSuiteLoader.java LoadingTestCollector.java ClassPathTestCollector.java SimpleTestCollector.java StandardTestSuiteLoader.java TestCaseClassLoader.java TestCollector.java Sorter.java Log Message: Merged with branch, Kent will make final changes and launch. Index: BaseTestRunner.java =================================================================== RCS file: /cvsroot/junit/junit/junit/runner/BaseTestRunner.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- BaseTestRunner.java 24 Oct 2004 07:37:06 -0000 1.18 +++ BaseTestRunner.java 15 Feb 2006 22:55:29 -0000 1.19 @@ -17,6 +17,7 @@ import junit.framework.AssertionFailedError; import junit.framework.Test; +import junit.framework.TestCase; import junit.framework.TestListener; import junit.framework.TestSuite; @@ -56,8 +57,7 @@ public static void savePreferences() throws IOException { FileOutputStream fos= new FileOutputStream(getPreferencesFile()); try { - // calling of the deprecated save method to enable compiling under 1.1.7 - getPreferences().save(fos, ""); + getPreferences().store(fos, ""); } finally { fos.close(); } @@ -96,7 +96,7 @@ clearStatus(); return null; } - Class testClass= null; + Class<? extends TestCase> testClass= null; try { testClass= loadSuiteClass(suiteClassName); } catch (ClassNotFoundException e) { @@ -204,8 +204,10 @@ /** * Returns the loaded Class for a suite name. */ - protected Class loadSuiteClass(String suiteClassName) throws ClassNotFoundException { - return getLoader().load(suiteClassName); + protected Class<? extends TestCase> loadSuiteClass(String suiteClassName) throws ClassNotFoundException { + @SuppressWarnings("unchecked") + Class<? extends TestCase> testClass = (Class<? extends TestCase>) Class.forName(suiteClassName); + return testClass; } /** @@ -214,17 +216,8 @@ protected void clearStatus() { // Belongs in the GUI TestRunner class } - /** - * Returns the loader to be used. - */ - public TestSuiteLoader getLoader() { - if (useReloadingTestSuiteLoader()) - return new ReloadingTestSuiteLoader(); - return new StandardTestSuiteLoader(); - } - protected boolean useReloadingTestSuiteLoader() { - return getPreference("loading").equals("true") && !inVAJava() && fLoading; + return getPreference("loading").equals("true") && fLoading; } private static File getPreferencesFile() { @@ -263,21 +256,6 @@ return intValue; } - public static boolean inVAJava() { - try { - Class.forName("com.ibm.uvm.tools.DebugSupport"); - } - catch (Exception e) { - return false; - } - return true; - } - - public static boolean inMac() { - return System.getProperty("mrj.version") != null; - } - - /** * Returns a filtered stack trace */ Index: Version.java =================================================================== RCS file: /cvsroot/junit/junit/junit/runner/Version.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Version.java 24 Oct 2004 07:45:54 -0000 1.12 +++ Version.java 15 Feb 2006 22:55:29 -0000 1.13 @@ -9,7 +9,8 @@ } public static String id() { - return "@version@"; + // TODO: auto-replace this + return "4.0"; } public static void main(String[] args) { --- FailureDetailView.java DELETED --- --- ReloadingTestSuiteLoader.java DELETED --- --- TestSuiteLoader.java DELETED --- --- LoadingTestCollector.java DELETED --- --- ClassPathTestCollector.java DELETED --- --- SimpleTestCollector.java DELETED --- --- StandardTestSuiteLoader.java DELETED --- --- TestCaseClassLoader.java DELETED --- --- TestCollector.java DELETED --- --- Sorter.java DELETED --- |
From: David S. <ds...@us...> - 2006-02-15 22:56:13
|
Update of /cvsroot/junit/junit/org/junit/runner/notification In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/runner/notification Added Files: RunNotifier.java Failure.java StoppedByUserException.java RunListener.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:12
|
Update of /cvsroot/junit/junit/junit/samples/money In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/samples/money Modified Files: Money.java IMoney.java MoneyTest.java MoneyBag.java Log Message: Merged with branch, Kent will make final changes and launch. Index: Money.java =================================================================== RCS file: /cvsroot/junit/junit/junit/samples/money/Money.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Money.java 26 Apr 2002 23:54:30 -0000 1.3 +++ Money.java 15 Feb 2006 22:55:29 -0000 1.4 @@ -36,6 +36,7 @@ public String currency() { return fCurrency; } + @Override public boolean equals(Object anObject) { if (isZero()) if (anObject instanceof IMoney) @@ -47,7 +48,10 @@ } return false; } + @Override public int hashCode() { + if (fAmount == 0) + return 0; return fCurrency.hashCode()+fAmount; } public boolean isZero() { @@ -62,6 +66,7 @@ public IMoney subtract(IMoney m) { return add(m.negate()); } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("["+amount()+" "+currency()+"]"); Index: IMoney.java =================================================================== RCS file: /cvsroot/junit/junit/junit/samples/money/IMoney.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- IMoney.java 26 Apr 2002 23:54:30 -0000 1.4 +++ IMoney.java 15 Feb 2006 22:55:29 -0000 1.5 @@ -37,6 +37,9 @@ public abstract IMoney subtract(IMoney m); /** * Append this to a MoneyBag m. + * appendTo() needs to be public because it is used + * polymorphically, but it should not be used by clients + * because it modifies the argument m. */ public abstract void appendTo(MoneyBag m); } \ No newline at end of file Index: MoneyTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/samples/money/MoneyTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- MoneyTest.java 9 Sep 2004 21:53:57 -0000 1.7 +++ MoneyTest.java 15 Feb 2006 22:55:29 -0000 1.8 @@ -14,6 +14,7 @@ public static void main(String args[]) { junit.textui.TestRunner.run(MoneyTest.class); } + @Override protected void setUp() { f12CHF= new Money(12, "CHF"); f14CHF= new Money(14, "CHF"); Index: MoneyBag.java =================================================================== RCS file: /cvsroot/junit/junit/junit/samples/money/MoneyBag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- MoneyBag.java 9 Sep 2004 21:53:57 -0000 1.5 +++ MoneyBag.java 15 Feb 2006 22:55:29 -0000 1.6 @@ -1,7 +1,7 @@ package junit.samples.money; -import java.util.Enumeration; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; /** * A MoneyBag defers exchange rate conversions. For example adding @@ -14,10 +14,10 @@ * A MoneyBag is represented as a list of Monies and provides * different constructors to create a MoneyBag. */ -class MoneyBag implements IMoney { - private Vector fMonies= new Vector(5); +public class MoneyBag implements IMoney { + private List<Money> fMonies= new ArrayList<Money>(5); - static IMoney create(IMoney m1, IMoney m2) { + public static IMoney create(IMoney m1, IMoney m2) { MoneyBag result= new MoneyBag(); m1.appendTo(result); m2.appendTo(result); @@ -33,22 +33,23 @@ return MoneyBag.create(s, this); } void appendBag(MoneyBag aBag) { - for (Enumeration e= aBag.fMonies.elements(); e.hasMoreElements(); ) - appendMoney((Money)e.nextElement()); + for (Money each : aBag.fMonies) + appendMoney(each); } void appendMoney(Money aMoney) { if (aMoney.isZero()) return; IMoney old= findMoney(aMoney.currency()); if (old == null) { - fMonies.addElement(aMoney); + fMonies.add(aMoney); return; } - fMonies.removeElement(old); - IMoney sum= old.add(aMoney); + fMonies.remove(old); + Money sum= (Money) old.add(aMoney); if (sum.isZero()) return; - fMonies.addElement(sum); + fMonies.add(sum); } + @Override public boolean equals(Object anObject) { if (isZero()) if (anObject instanceof IMoney) @@ -59,21 +60,17 @@ if (aMoneyBag.fMonies.size() != fMonies.size()) return false; - for (Enumeration e= fMonies.elements(); e.hasMoreElements(); ) { - Money m= (Money) e.nextElement(); - if (!aMoneyBag.contains(m)) + for (Money each : fMonies) + if (! aMoneyBag.contains(each)) return false; - } return true; } return false; } private Money findMoney(String currency) { - for (Enumeration e= fMonies.elements(); e.hasMoreElements(); ) { - Money m= (Money) e.nextElement(); - if (m.currency().equals(currency)) - return m; - } + for (Money each : fMonies) + if (each.currency().equals(currency)) + return each; return null; } private boolean contains(Money m) { @@ -81,12 +78,11 @@ if (found == null) return false; return found.amount() == m.amount(); } + @Override public int hashCode() { int hash= 0; - for (Enumeration e= fMonies.elements(); e.hasMoreElements(); ) { - Object m= e.nextElement(); - hash^= m.hashCode(); - } + for (Money each : fMonies) + hash^= each.hashCode(); return hash; } public boolean isZero() { @@ -94,35 +90,31 @@ } public IMoney multiply(int factor) { MoneyBag result= new MoneyBag(); - if (factor != 0) { - for (Enumeration e= fMonies.elements(); e.hasMoreElements(); ) { - Money m= (Money) e.nextElement(); - result.appendMoney((Money)m.multiply(factor)); - } - } + if (factor != 0) + for (Money each : fMonies) + result.appendMoney((Money) each.multiply(factor)); return result; } public IMoney negate() { MoneyBag result= new MoneyBag(); - for (Enumeration e= fMonies.elements(); e.hasMoreElements(); ) { - Money m= (Money) e.nextElement(); - result.appendMoney((Money)m.negate()); - } + for (Money each : fMonies) + result.appendMoney((Money) each.negate()); return result; } private IMoney simplify() { if (fMonies.size() == 1) - return (IMoney)fMonies.elements().nextElement(); + return fMonies.iterator().next(); return this; } public IMoney subtract(IMoney m) { return add(m.negate()); } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("{"); - for (Enumeration e= fMonies.elements(); e.hasMoreElements(); ) - buffer.append(e.nextElement()); + for (Money each : fMonies) + buffer.append(each); buffer.append("}"); return buffer.toString(); } |
From: David S. <ds...@us...> - 2006-02-15 22:56:12
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/internal/runners Added Files: TestIntrospector.java MethodValidator.java ErrorReportingRunner.java OldTestClassRunner.java TestClassMethodsRunner.java TextListener.java TestClassRunner.java TestMethodRunner.java BeforeAndAfterRunner.java InitializationError.java CompositeRunner.java Log Message: Merged with branch, Kent will make final changes and launch. |
Update of /cvsroot/junit/junit/org/junit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit Added Files: AfterClass.java Before.java Ignore.java Assert.java Test.java After.java ComparisonFailure.java BeforeClass.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:11
|
Update of /cvsroot/junit/junit/org/junit/runner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/runner Added Files: JUnitCore.java Description.java Runner.java Result.java Request.java RunWith.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:11
|
Update of /cvsroot/junit/junit/junit/tests/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/tests/framework Modified Files: TestImplementorTest.java AssertTest.java TestCaseTest.java DoublePrecisionAssertTest.java Success.java AllTests.java Failure.java OverrideTestCase.java TestListenerTest.java SuiteTest.java Added Files: FloatAssertTest.java Log Message: Merged with branch, Kent will make final changes and launch. Index: TestImplementorTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/TestImplementorTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TestImplementorTest.java 9 Sep 2004 21:53:55 -0000 1.3 +++ TestImplementorTest.java 15 Feb 2006 22:55:32 -0000 1.4 @@ -37,6 +37,7 @@ public TestImplementorTest() { TestCase testCase= new TestCase() { + @Override public void runTest() { } }; Index: AssertTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/AssertTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- AssertTest.java 1 Sep 2002 15:29:53 -0000 1.9 +++ AssertTest.java 15 Feb 2006 22:55:32 -0000 1.10 @@ -38,7 +38,7 @@ } public void testAssertEqualsNull() { - assertEquals(null, null); + assertEquals((Object) null, (Object) null); } public void testAssertStringEquals() { Index: TestCaseTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/TestCaseTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- TestCaseTest.java 11 Oct 2004 19:22:09 -0000 1.7 +++ TestCaseTest.java 15 Feb 2006 22:55:32 -0000 1.8 @@ -17,9 +17,11 @@ static class TornDown extends TestCase { boolean fTornDown= false; + @Override protected void tearDown() { fTornDown= true; } + @Override protected void runTest() { throw new Error("running"); } @@ -33,6 +35,7 @@ } public void testError() { TestCase error= new TestCase("error") { + @Override protected void runTest() { throw new Error(); } @@ -41,10 +44,12 @@ } public void testRunAndTearDownFails() { TornDown fails= new TornDown() { + @Override protected void tearDown() { super.tearDown(); throw new Error(); } + @Override protected void runTest() { throw new Error(); } @@ -54,9 +59,11 @@ } public void testSetupFails() { TestCase fails= new TestCase("success") { + @Override protected void setUp() { throw new Error(); } + @Override protected void runTest() { } }; @@ -64,6 +71,7 @@ } public void testSuccess() { TestCase success= new TestCase("success") { + @Override protected void runTest() { } }; @@ -71,6 +79,7 @@ } public void testFailure() { TestCase failure= new TestCase("failure") { + @Override protected void runTest() { fail(); } @@ -86,9 +95,11 @@ public void testTearDownFails() { TestCase fails= new TestCase("success") { + @Override protected void tearDown() { throw new Error(); } + @Override protected void runTest() { } }; @@ -96,6 +107,7 @@ } public void testTearDownSetupFails() { TornDown fails= new TornDown() { + @Override protected void setUp() { throw new Error(); } @@ -113,22 +125,25 @@ // wrap the exception thrown while running with the exception thrown // while tearing down Test t= new TornDown() { + @Override public void tearDown() { throw new Error("tearingDown"); } }; TestResult result= new TestResult(); t.run(result); - TestFailure failure= (TestFailure) result.errors().nextElement(); + TestFailure failure= result.errors().nextElement(); 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"); } Index: DoublePrecisionAssertTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/DoublePrecisionAssertTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- DoublePrecisionAssertTest.java 23 Oct 2004 01:06:41 -0000 1.3 +++ DoublePrecisionAssertTest.java 15 Feb 2006 22:55:32 -0000 1.4 @@ -11,19 +11,17 @@ public void testAssertEqualsNaNFails() { try { assertEquals(1.234, Double.NaN, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertNaNEqualsFails() { try { assertEquals(Double.NaN, 1.234, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertNaNEqualsNaN() { @@ -33,19 +31,17 @@ public void testAssertPosInfinityNotEqualsNegInfinity() { try { assertEquals(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertPosInfinityNotEquals() { try { assertEquals(Double.POSITIVE_INFINITY, 1.23, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertPosInfinityEqualsInfinity() { Index: Success.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/Success.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Success.java 9 Sep 2004 21:53:55 -0000 1.4 +++ Success.java 15 Feb 2006 22:55:32 -0000 1.5 @@ -8,6 +8,7 @@ */ public class Success extends TestCase { + @Override public void runTest() { } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/AllTests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AllTests.java 24 Oct 2004 06:41:48 -0000 1.7 +++ AllTests.java 15 Feb 2006 22:55:32 -0000 1.8 @@ -24,6 +24,7 @@ suite.addTestSuite(ComparisonCompactorTest.class); suite.addTestSuite(ComparisonFailureTest.class); suite.addTestSuite(DoublePrecisionAssertTest.class); + suite.addTestSuite(FloatAssertTest.class); return suite; } Index: Failure.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/Failure.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Failure.java 9 Sep 2004 21:53:55 -0000 1.4 +++ Failure.java 15 Feb 2006 22:55:32 -0000 1.5 @@ -7,6 +7,7 @@ * */ public class Failure extends TestCase { + @Override public void runTest() { fail(); } Index: OverrideTestCase.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/OverrideTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- OverrideTestCase.java 30 Mar 2002 22:37:40 -0000 1.2 +++ OverrideTestCase.java 15 Feb 2006 22:55:32 -0000 1.3 @@ -4,6 +4,7 @@ * Test class used in SuiteTest */ public class OverrideTestCase extends OneTestCase { + @Override public void testCase() { } } \ No newline at end of file Index: TestListenerTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/TestListenerTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TestListenerTest.java 9 Sep 2004 21:53:55 -0000 1.3 +++ TestListenerTest.java 15 Feb 2006 22:55:32 -0000 1.4 @@ -25,6 +25,7 @@ public void endTest(Test test) { fEndCount++; } + @Override protected void setUp() { fResult= new TestResult(); fResult.addListener(this); @@ -38,6 +39,7 @@ } public void testError() { TestCase test= new TestCase("noop") { + @Override public void runTest() { throw new Error(); } @@ -48,6 +50,7 @@ } public void testFailure() { TestCase test= new TestCase("noop") { + @Override public void runTest() { fail(); } @@ -58,6 +61,7 @@ } public void testStartStop() { TestCase test= new TestCase("noop") { + @Override public void runTest() { } }; Index: SuiteTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/SuiteTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SuiteTest.java 23 Oct 2004 22:06:58 -0000 1.6 +++ SuiteTest.java 15 Feb 2006 22:55:32 -0000 1.7 @@ -14,6 +14,7 @@ public SuiteTest(String name) { super(name); } + @Override protected void setUp() { fResult= new TestResult(); } @@ -21,7 +22,6 @@ TestSuite suite= new TestSuite("Suite Tests"); // build the suite manually, because some of the suites are testing // the functionality that automatically builds suites - suite.addTest(new SuiteTest("testNoTestCaseClass")); suite.addTest(new SuiteTest("testNoTestCases")); suite.addTest(new SuiteTest("testOneTestCase")); suite.addTest(new SuiteTest("testNotPublicTestCase")); @@ -40,12 +40,13 @@ assertTrue(fResult.wasSuccessful()); assertEquals(2, fResult.runCount()); } - public void testNoTestCaseClass() { - Test t= new TestSuite(NoTestCaseClass.class); - t.run(fResult); - assertEquals(1, fResult.runCount()); // warning test - assertTrue(! fResult.wasSuccessful()); - } +// This test case is obsolete, since the compiler will catch this error in 1.5 +// public void testNoTestCaseClass() { +// Test t= new TestSuite(NoTestCaseClass.class); +// t.run(fResult); +// assertEquals(1, fResult.runCount()); // warning test +// assertTrue(! fResult.wasSuccessful()); +// } public void testNoTestCases() { Test t= new TestSuite(NoTestCases.class); t.run(fResult); @@ -89,8 +90,7 @@ assertEquals(1, fResult.runCount()); } public void testCreateSuiteFromArray() { - Class[] testClassArray = { OneTestCase.class, DoublePrecisionAssertTest.class }; - TestSuite suite = new TestSuite(testClassArray); + TestSuite suite = new TestSuite(OneTestCase.class, DoublePrecisionAssertTest.class); assertEquals(2, suite.testCount()); assertEquals("junit.tests.framework.DoublePrecisionAssertTest" , ((TestSuite)suite.testAt(1)).getName()); assertEquals("junit.tests.framework.OneTestCase" , ((TestSuite)suite.testAt(0)).getName()); |
Update of /cvsroot/junit/junit/org/junit/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/tests Added Files: UserStopTest.java ParameterizedTestMethodTest.java TestMethodTest.java ForwardCompatibilityTest.java TimeoutTest.java CustomRunnerTest.java SuiteTest.java SortableTest.java ValidationTest.java TextListenerTest.java PreJUnit4TestCaseRunnerTest.java ParameterizedTestTest.java AllTestsTest.java JUnitCoreTest.java InitializationErrorForwardCompatibilityTest.java FailedConstructionTest.java AnnotationTest.java RunWithTest.java TestListenerTest.java ForwardCompatibilityPrintingTest.java OldTests.java RunnerTest.java AllTests.java TestDescriptionTest.java AssertionTest.java SingleMethodTest.java ExpectedTest.java CommandLineTest.java OldTestClassRunnerTest.java SuiteDescriptionTest.java EnclosedTest.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:11
|
Update of /cvsroot/junit/junit/org/junit/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/org/junit/samples Added Files: SimpleTest.java ListTest.java Log Message: Merged with branch, Kent will make final changes and launch. |
From: David S. <ds...@us...> - 2006-02-15 22:56:11
|
Update of /cvsroot/junit/junit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390 Modified Files: build.xml .project README.html .classpath Added Files: junit4.0.zip .cvsignore done.txt .temp$junit.arx to-do.txt Log Message: Merged with branch, Kent will make final changes and launch. --- NEW FILE: junit4.0.zip --- PK [...2796 lines suppressed...] S< Index: build.xml =================================================================== RCS file: /cvsroot/junit/junit/build.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- build.xml 17 Nov 2004 22:47:23 -0000 1.13 +++ build.xml 15 Feb 2006 22:55:27 -0000 1.14 @@ -1,11 +1,12 @@ -<!-- JUnit build script using ant 1.4 --> <project name="junit" default="dist" basedir="."> <property file="${user.home}/.junit.properties" /> - <property name="build.compiler" value="classic" /> - <property name="version" value="3.8.2" /> + <property name="version" value="4.0" /> <property name="dist" value="junit${version}" /> <property name="versionfile" value="junit/runner/Version.java" /> <property name="zipfile" value="${dist}.zip" /> + <property name="unjarred" value="**/*.jar, **/junit/tests/**, **/junit/samples/**, doc/**, README.html, .classpath, .project, cpl-v10.html" /> + <property name="jarfile" value="junit-${version}.jar" /> + <target name="init"> <tstamp/> </target> @@ -28,37 +29,36 @@ /> </target> + <target name="distributeTestsAndExamples"> + <copy todir="${dist}/${dir}"> + <fileset dir="${dir}" includes="junit/samples/**, junit/tests/**" /> + </copy> + </target> + <target name="dist" depends="build"> <delete dir="${dist}" /> <mkdir dir="${dist}" /> <jar - jarfile="${dist}/src.jar" + jarfile="${dist}/junit-${version}-src.jar" basedir="." - excludes="**/*.jar, junit/tests/**, junit/samples/**, **/*.class, doc/**, README.html, stylesheet.css, build.xml, .classpath, .project, .settings/**, cpl-v10.html" + excludes="${unjarred}, **/*.class" /> <jar - jarfile="${dist}/junit.jar" + jarfile="${dist}/${jarfile}" basedir="." - excludes="**/*.jar, junit/tests/**, junit/samples/**, **/*.java, doc/**, README.html, stylesheet.css, build.xml, jar-manifest.txt, .classpath, .project, .settings/**, cpl-v10.html" + excludes="${unjarred}, **/*.java, build.xml" /> - <copy todir="${dist}/junit/samples"> - <fileset dir="junit/samples" /> - </copy> - <copy todir="${dist}/junit/tests"> - <fileset dir="junit/tests" /> - </copy> - - - <delete file="${dist}/junit/tests/runner/test.jar"/> - <jar jarfile="${dist}/junit/tests/runner/test.jar" - basedir="." - includes="junit/tests/runner/LoadedFromJar.class" - /> + <antcall target="distributeTestsAndExamples"> + <param name="dir" value="." /> + </antcall> + <antcall target="distributeTestsAndExamples"> + <param name="dir" value="org" /> + </antcall> <mkdir dir="${dist}/javadoc" /> <javadoc sourcepath="." - packagenames="junit.framework.*, junit.extensions.*" + packagenames="org.junit, org.junit.runner, org.junit.runner.description, org.junit.runner.manipulation, org.junit.runner.notification, org.junit.runners" destdir="${dist}/javadoc" author="false" version="false" @@ -72,11 +72,11 @@ <copy file="README.html" tofile="${dist}/README.html" /> <copy file="cpl-v10.html" tofile="${dist}/cpl-v10.html" /> - <java classname="junit.textui.TestRunner" fork="yes"> - <arg value="junit.samples.AllTests" /> + <java classname="org.junit.runner.JUnitCore" fork="yes"> + <arg value="org.junit.tests.AllTests"/> <classpath> <pathelement location="${dist}" /> - <pathelement location="${dist}/junit.jar" /> + <pathelement location="${dist}/${jarfile}" /> </classpath> </java> </target> @@ -89,28 +89,6 @@ /> </target> - <target name="awtui" depends="dist"> - <java classname="junit.awtui.TestRunner" fork="yes"> - <arg value="-noloading" /> - <arg value="junit.samples.AllTests" /> - <classpath> - <pathelement location="${dist}" /> - <pathelement location="${dist}/junit.jar" /> - </classpath> - </java> - </target> - - <target name="swingui" depends="dist"> - <java classname="junit.swingui.TestRunner" fork="yes"> - <arg value="-noloading" /> - <arg value="junit.samples.AllTests" /> - <classpath> - <pathelement location="${dist}" /> - <pathelement location="${dist}/junit.jar" /> - </classpath> - </java> - </target> - <target name="clean"> <delete dir="${dist}" quiet="true"/> <delete file="${zipfile}" quiet="true"/> Index: .project =================================================================== RCS file: /cvsroot/junit/junit/.project,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- .project 11 Oct 2004 19:22:08 -0000 1.3 +++ .project 15 Feb 2006 22:55:27 -0000 1.4 @@ -10,11 +10,6 @@ <arguments> </arguments> </buildCommand> - <buildCommand> - <name>com.agitar.eclipse.project.agitatorbuilder</name> - <arguments> - </arguments> - </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> Index: README.html =================================================================== RCS file: /cvsroot/junit/junit/README.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- README.html 17 Nov 2004 22:07:28 -0000 1.10 +++ README.html 15 Feb 2006 22:55:28 -0000 1.11 @@ -1,736 +1,211 @@ -<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> - <meta http-equiv="Content-Type" - content="text/html; charset=iso-8859-1"> - <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> - <meta name="Author" content="Erich Gamma & Kent Beck"> - <title>JUnit 3.8</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> + <meta name="Author" content="Erich Gamma & Kent Beck"> + <title>JUnit 3.8</title> </head> <body> + <h1> -<b><font color="#00cc00">J</font><font color="#ff0000">U</font><font - color="#000000">nit -3.8.2</font></b></h1> -<hr width="100%"> -<font color="#000000"><br> -11/11/2004<br> -</font> +<b><font color="#00CC00">J</font><font color="#FF0000">U</font><font color="#000000">nit +4.0</b></h1> + +<hr WIDTH="100%"> +<br>08/31/2002 +<p>JUnit is a simple framework to write repeatable tests. It is an instance +of the xUnit architecture for unit testing frameworks. <ul> - <li><font color="#000000"><a href="#Summary%20of">Summary of Changes</a></font></li> - <li> - <font color="#000000"><a href="#Contents">Contents</a></font></li> - <li> - <font color="#000000"><a href="#Installation">Installation</a></font></li> - <li> - <font color="#000000"><a href="#Getting">Getting Started</a></font></li> - <li> - <font color="#000000"><a href="#Documentation">Documentation</a></font></li> +<li> +<a href="#Summary of">Summary of Changes</a></li> + +<li> +<a href="#Contents">Contents</a></li> + +<li> +<a href="#Installation">Installation</a></li> + +<li> +<a href="#Getting">Getting Started</a></li> + +<li> +<a href="#Documentation">Documentation</a></li> </ul> + <h2> -<font><a name="Summary of"></a><font color="#000000">Summary of Changes -between 3.8.1 and 3.8.2</font></font></h2> -<font color="#000000">The changes between the versions are minimal and -the focus was on fixing the accumulated bug reports. The most -signifanct change is replacing the much-reviled string comparison -format with something easier to read and use.<br> -</font> -<ul> - <li>ComparisonFailure shows context. <br> - </li> - <ul> - <li>assertEquals("Mary had a little lamb", "Mary had the little -lamb") shows: expected:<Mary had [a] little lamb> but -was:<Mary had [the] little lamb><br> -Longer prefixes and suffixes are truncated to a fixed size (currently -20):</li> - <li>expected:<...st of the emergency [broadcasting] -system> but was:<...st of the emergency [locating] system><br> - </li> - </ul> - <li><font color="#000000">Running single tests. -junit.ui.TestRunner can be invoked with "-m</font> ClassName.testName" -to run a single test.</li> - <li>TestSuite(Class[]). -There is a new TestSuite constructor that takes an array of classes as -a parameter and returns a suite of suites, each of which is constructed -from a single class.</li> -</ul> -<h3><font><font color="#000000">Closed Bugs/Patches and Enhancment -Requests<br> -</font></font></h3> -<ul> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=698067&group_id=15278&atid=115278">assertEquals(float,float,delta) -fails on negative delta</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=609972&group_id=15278&atid=115278">'...' -in ComparisonFailure</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=461535&group_id=15278&atid=115278">Trouble -in teardown hides orig. probl.</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=609819&group_id=15278&atid=115278">NaN's -in assertEquals</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=620039&group_id=15278&atid=115278">BaseTestRunner.setPreference -static</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=658044&group_id=15278&atid=115278">failNotEquals() -should be protected</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=777097&group_id=15278&atid=115278">RFE: -make private methods protected</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=654507&group_id=15278&atid=365278">Printing -version number</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=993150&group_id=15278&atid=315278">Patch -to quell warnings in tiger</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=657593&group_id=15278&atid=315278">Enhanced -ComparisonFailure output</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=625016&group_id=15278&atid=315278">addt'l -TestSuite constructrs for Class[]</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=908467&group_id=15278&atid=315278">Run -one test method for junit</a></li> - <li><a - href="http://sourceforge.net/tracker/index.php?func=detail&aid=756480&group_id=15278&atid=315278">excluded.properties: -Add commons logging</a></li> -</ul> -<h2><font color="#000000">Summary of Changes between 3.8 and 3.8.1</font></h2> +<a NAME="Summary of"></a>Summary of Changes with version 4.0</h2> + <ul> - <font color="#000000"> <li>Backed out setting the testing Thread's -context class loader (see <a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=598200&group_id=15278&atid=115278">JUnit -not setting ClassLoader</a>). It has caused problems in tests that -worked OK before. See the bug report for more details.</li> + <li>Backed out setting the testing Thread's context class loader (see <a href="https://sourceforge.net/tracker/index.php?func=detail&aid=598200&group_id=15278&atid=115278">JUnit + not setting ClassLoader</a>). It has caused problems in tests that + worked OK before. See the bug report for more details.</li> <li>Fixes: <ul> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=601326&group_id=15278&atid=115278">NPE -in ComparisonFailure</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=602948&group_id=15278&atid=115278">Swing -UI: NoSuchMethodError on JDK 1.3</a></li> + <li><a href="https://sourceforge.net/tracker/index.php?func=detail&aid=601326&group_id=15278&atid=115278">NPE + in ComparisonFailure</a></li> + <li><a href="https://sourceforge.net/tracker/index.php?func=detail&aid=602948&group_id=15278&atid=115278">Swing + UI: NoSuchMethodError on JDK 1.3</a></li> </ul> </li> - </font> -</ul> -<h2> -<font color="#000000">Summary of Changes between 3.7 and 3.8</font></h2> -<h3> -<font color="#000000">Framework</font></h3> -<ul> - <li> - <font color="#000000">Made the string argument TestCase constructor -optional. You can now delete -constructors of the form "FooTestCase(String name) { super(name); }".</font></li> - <li> - <font color="#000000">Deleted deprecated assert(boolean) in favor -of assertTrue(boolean) and -assertFalse(boolean). To migrate to JUnit 3.8, rename calls to -assert(boolean) -to call assertTrue(boolean).</font></li> - <li> - <font color="#000000">Added assertFalse() to avoid the difficult of -reading the assertTrue(! -condition).</font></li> - <li> - <font color="#000000">Added assertNotSame(Object, Object).</font></li> - <li> - <font color="#000000">Deleted deprecated TestCase.name() in favor -of TestCase.getName().</font></li> - <li> - <font color="#000000">Deleted deprecated package junit.ui in favor -of junit.awtui.</font></li> -</ul> -<h3> -<font color="#000000">Test Runner</font></h3> -<ul> - <li> - <font color="#000000">When you compare two long strings with a -small delta embedded in the middle, it -is hard to spot the difference. In 3.8, when you call -assertEquals(String, -String), only the differences between the strings are displayed. The -common -prefix and suffix are replaced with "...".</font></li> - <li> - <font color="#000000">Added initial version of a TestRunListener -attached to TestRunners which -eventually will replace TestListeners attached to the TestResult.</font></li> - <li> - <font color="#000000">Filled in ActiveTestSuite constructors.</font></li> - <li> - <font color="#000000">Added these packages to the -excluded.properties:<font size="2"> - <ul> - <li>org.w3c.dom.*</li> - <li>org.xml.sax.*</li> - <li>net.jini.*</li> - </ul> - </font></font></li> - <li><font color="#000000">Extracted textual formatting of a -TestResult from junit.textui.TestRunner into ResultPrinter.</font></li> -</ul> -<h3><font color="#000000">Documentation</font></h3> -<ul> - <font color="#000000"> <li>Much improved <a href="doc/faq/faq.htm">FAQ</a> -thanks to Mike Clark.</li> - </font> -</ul> -<h3><font color="#000000">Closed Bugs</font></h3> -<ul> - <font color="#000000"> <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=583346&group_id=15278&atid=115278">Class -loader problem</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=551239&group_id=15278&atid=115278">Cookbook -Simple Test Case problems</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=539015&group_id=15278&atid=115278">License -not included in source</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=560081&group_id=15278&atid=115278">assert -is a keyword</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=572444&group_id=15278&atid=115278">javadoc -returns mysterious message</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=581251&group_id=15278&atid=115278">swingui -CounterPanel values disappear</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=574641&group_id=15278&atid=115278">TestCase -javadoc incorrect example</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=582784&group_id=15278&atid=115278">silly -cookbook error</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=583328&group_id=15278&atid=115278">junit -properties missfunction</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=595957&group_id=15278&atid=115278">Test.java -is not Serializable</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=598200&group_id=15278&atid=115278">JUnit -not setting ClassLoader`</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=592713&group_id=15278&atid=115278">NullPointerException -when loading suite</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=544683&group_id=15278&atid=115278">labels -for bug counts too small in Swing</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=537502&group_id=15278&atid=115278">Swing -TestRunner layout shifts</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=528868&group_id=15278&atid=115278">Exit -code problem for cygwin/w2k</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=529953&group_id=15278&atid=115278">Automatic -reload causes strange errors</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=532952&group_id=15278&atid=115278">TestRunner -fails with swing/awtui</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=533411&group_id=15278&atid=115278">CVS -version doesn't build on NetBSD</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=520210&group_id=15278&atid=115278">NullPointerException -JUnit sample w/ Ant</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=527511&group_id=15278&atid=115278">money -sample bug</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=491981&group_id=15278&atid=115278">incomplete -message from failNotSame()</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=471577&group_id=15278&atid=115278">Icons -on systems with 64 colors exceptio</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=470324&group_id=15278&atid=115278">1000+ -tests, swing gui doesn't display</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=442752&group_id=15278&atid=115278">test -selector included incorrect classes</a></li> - <li><a - href="https://sourceforge.net/tracker/index.php?func=detail&aid=430974&group_id=15278&atid=115278">No -UI update when re-run methods fail</a></li> - </font> -</ul> -<h2> -<font color="#000000">Summary of Changes between 3.6 and 3.7</font></h2> -<h3> -<font color="#000000">GUI</font></h3> -<ul> - <li> - <font color="#000000">Eliminated warning when re-running tests when -class loading checkbox is -unchecked. There are legitimate reasons for doing this, so a warning -didn't -make much sense, and it was too obtrusive.</font></li> - <li> - <font color="#000000">Stopped reloading classes when running in -VisualAge for Java.</font></li> - <li> - <font color="#000000">Print total number of tests as well as number -of tests run so far (Swing -only).</font></li> -</ul> -<h3> -<font color="#000000">Framework</font></h3> -<ul> - <li> - <font color="#000000">Introduced Assert.assertTrue(boolean) and -assertTrue(String, boolean) deprecated -assert(boolean) and assert(String, boolean) in preparation for the -assert -keyword in Java 1.4. We plan to support native assertions when they are -publicly available. You can either move to assertTrue() or wait for 1.4 -and delete parentheses as the syntax is e.g. "assert 2 == 3".</font></li> - <li> - <font color="#000000">Added accessors for TestCase.fName and -TestSuite.fName.</font></li> - <li> - <font color="#000000">Added a no argument TestCase constructor to -support serialization.</font></li> - <li> - <font color="#000000">Improved warnings when constructing -TestSuites.</font></li> -</ul> -<h3> -<font color="#000000">Text Runner</font></h3> -<ul> - <li> - <font color="#000000">Made doRun() public so clients can create a -text runner with a specified -output stream and then run tests.</font></li> -</ul> -<h3> -<font color="#000000">Fixed Bugs (SourceForge Bug Tracker Ids)</font></h3> -<font color="#000000"> [420315] No trace when fail -with message... -<br> - [419375] reload warning lags -<br> - [418849] Classloader warning too obtrusive -<br> - [417978] constructor stack trace, please -<br> - [415103] Reload checkbox should be ignored in VAJ -<br> - [414954] error reporting when invoking suite() -<br> - [407296] Make doRun() public -<br> - [227578] rmi callbacks fail since TestCase has no -noArg constructor -<br> - [422603] Decorated decorators bug -</font> -<h2><font color="#000000">Summary of Changes between 3.5 and 3.6</font></h2> -<h3> -<font color="#000000">TestRunner</font></h3> -<ul> - <li> - <font color="#000000">The UI test runners provide a check box to -enable/disable the custom class -loader. The user is warned when running a second test with the non -loading -class loader.</font></li> - <li> - <font color="#000000">Renames to address file name length -limitation on MacOS:</font></li> - <ul> - <li> - <font color="#000000">LoadingClassPathTestCollector -> -LoadingTestCollector</font></li> - <li> - <font color="#000000">SimpleClassPathTestCollector -> -SimpleTestCollector</font></li> - </ul> </ul> -<h3> -<font color="#000000">Framework</font></h3> -<ul> - <li> - <font color="#000000">Added TestSuite.getName()</font></li> -</ul> -<h3> -<font color="#000000">Builds</font></h3> -<ul> - <li> - <font color="#000000">Updated the build script for Ant 1.3.</font></li> -</ul> -<h3> -<font color="#000000">Fixed Bugs (SourceForge Bug Tracker Ids)</font></h3> -<blockquote><font color="#000000">[ #229753 ] assertEquals on NaN and -Infinity does not work -correctly - <br> -[ #229287 ] Class Name too long "SimpleClassPathTestCollector" - <br> -[ #229609 ] Stack Filtering missing in textui.TesRunner - <br> -[ #229870 ] Clicking on ... after tests failed gives NPE - <br> -[ #229974 ] Incorrect icon shown for first element in Swing GUI - <br> -[ #230581 ] swingui.TestTreeModel: results of decorated testcases... - <br> -[ #230971 ] Make junit.extensions.TestDecorator.getTest() public - <br> -[ #231569 ] DocBug: JUnit Test Infected: Programmers Love Writing Tests - <br> -[ #232645 ] BaseTestRunner.getTest loses exception information - <br> -[ #233094 ] TestSuite masks exceptions - <br> -[ #410967 ] No icon provided for first test - <br> -[ #230745 ] ClassPathTestCollector sometimes lists classes in duplicate</font></blockquote> -<h3> -<font color="#000000">Documentation</font></h3> -<ul> - <li> - <font color="#000000">Added documentation about the <a - href="doc/JUnitProperties.html">properties</a> -supported by TestRunners.</font></li> - <li> - <font color="#000000">Updated the FAQ</font></li> -</ul> -<h2> -<font color="#000000">Summary of Changes between 3.4 and 3.5</font></h2> -<h3> -<font color="#000000">Framework</font></h3> -<ul> - <li> - <font color="#000000">Added TestSuite.addTestSuite(Class testClass)</font></li> - <font color="#000000"><br> -This method allows to create a TestSuite with a class containing test -cases directly. - <br> -Instead of writing <b>suite.addTest(new TestSuite(AssertTest.class)) - </b>you -can now write <b>suite.addTestSuite(AssertTest.class)</b>; - <li>Added assertEquals methods for all primitive types: float, -boolean, byte, -char, int, short</li> - <li> -The signature of TestListeners.addFailure(Test test, Throwable t)</li> - <br> -was changed to addFailure(Test test, AssertionFailedError t)</font> -</ul> -<h3> -<font color="#000000">TestRunner</font></h3> -<ul> - <li> - <font color="#000000">The Swing TestRunner provides an experimental -feature to browse test classes. -There is an additional browse ("...") button besides the suite combo. -It -shows a simple dialog to select a test class from a list. Different -strategies -to locate Test classes are supported and you can plug-in your own -strategy. -This allows to leverage functionality provided by an extension API of -an -integrated development environment (IDE). To define a custom test -collector -you 1) implement the <b>junit.runner.TestCollector </b>interface and -2) -add an entry to the <b>junit.properties</b> file with the key <b>TestCollectorClass</b> -and the name of your TestCollector implementation class as the key:</font></li> - <font color="#000000"><br> - -TestCollectorClass=junit.swingui.LoadingClassPathTestCollector - <br> -This class has to be installed on the class path. - <br> -JUnit provides two different TestCollector implementations: - </font> - <ul> - <li> - <font color="#000000">simple -(junit.runner.SimpleClassPathTestCollector) - considers all classes -on the class path on the file system that contain "Test" in their name. -Classes in JARs are not considered.</font></li> - <li> - <font color="#000000">loading -(junit.runner.LoadingClassPathTestCollector) - loads all classes -on the class path and tests whether the class is assignable from Test -or -has a static <b>suite</b> method.</font></li> - </ul> - <font color="#000000">By default the simple the test collector is -used. The loading collector -is more precise but much slower than the simple one. The loading -collector -doesn't scale up when many classes are available on the class path. - <br> - <b><font color="#ff0000">Notice</font></b>: that both TestCollectors -assume that the class files reside are kept in the file system. This -isn't -case in VA/Java and they will not work there. A custom TestCollector is -required for VA/Java. - <li>The Swing TestRunner now provides an additional test result view -that shows -all tests of the executed test suite as a tree. The view shows the -success -status for each test. The view is shown as an additional tab in the -TestRunner -window. In previous versions of JUnit this view was shown in a separate -window.</li> - <li> -The failure panels in the Swing and AWT TestRunners filter the -exception -stack trace so that only non-framework stack frames are shown.</li> - <li> -There is support to plug-in a custom failure panel that provides -additional -functionality like navigating from a failure to the source. To do so -you -implement the <b>junit.runner.FailureDetailView</b> interface and -register -the implementation class in the junit.properties file under the key <b>FailureViewClass</b>, -for example</li> - <br> - -FailureViewClass=MyFailureViewClassName. - <li>The Swing and AWT TestRunners now understand an additional -command line -argument "-noloading". When this argument is set then the standard -system -class loader is used to load classes. This is an alternative to setting -the <b>loading</b> property to false in the junit.properties file.</li> - <li> -Swing TestRunner - the maximum test history length shown in the suite -combo -can be defined in the junit.properties file with the key <b>maxhistory</b>.</li> - <li> -BaseTestRunner.<b>getLoader</b>() is no longer a static method and can -now be overridden in subclasses.</li> - <li> -BaseTestRunner removed dependency on JDK 1.2.</li> - <li> -Swing TestRunner - fixed the problem that a suite name was sometimes -duplicated -in the history combo.</li> - <li> -Swing TestRunner - the Run button is now the default button.</li> - <li> -Output string truncation can now be controlled by adding the <b>maxmessage</b> -key with the desired maximum length to the junit.properties file. -Setting -maxmessage to -1 means no output truncation.</li> - <li> -The Text TestRunner now shows the summary at the very end so that you -don't -have to scroll back.</li> - </font> -</ul> -<h3> -<font color="#000000">Tests</font></h3> -<ul> - <li> - <font color="#000000">TextRunnerTest now only depends on a nonzero -status to indicate abnormal -termination.</font></li> - <li> - <font color="#000000">TextRunnerTest now also passes on JDK 1.1.*. -It uses the -classpath command -line argument instead of -cp.</font></li> -</ul> -<h3> -<font color="#000000">Documentation</font></h3> -<ul> - <li> - <font color="#000000">Add an FAQ entry about what to do when the -junit tests provided with the -distribution can't be found.</font></li> -</ul> -<h2> -<font color="#000000">Older Change Notes</font></h2> -<blockquote> - <li><font color="#000000">Changes between <a - href="doc/changes34.html">2.1 and 3.4</a></font></li> - <li> - <font color="#000000">Changes between <a href="doc/changes21.html">1.0 -and 2.1</a></font></li> -</blockquote> + + <h2> -<font color="#000000"><a name="Contents"></a>Contents of the Release</font></h2> -<table cellspacing="0" cellpadding="0"> - <tbody> - <tr> - <td><tt>README.html </tt></td> - <td>this file</td> - </tr> - <tr> - <td><tt>junit.jar</tt></td> - <td>a jar file with the JUnit framework and tools </td> - </tr> - <tr> - <td>src.jar</td> - <td>a jar file with the source code of the junit framework</td> - </tr> - <tr> - <td><tt>junit</tt></td> - <td>the source code of the JUnit samples</td> - </tr> - <tr> - <td><tt> samples</tt></td> - <td>sample test cases</td> - </tr> - <tr> - <td><tt> tests</tt></td> - <td>test cases for JUnit itself</td> - </tr> - <tr> - <td><tt>javadoc</tt></td> - <td>javadoc generated documentation</td> - </tr> - <tr> - <td><tt>doc</tt></td> - <td>documentation and articles</td> - </tr> - </tbody> +<a NAME="Contents"></a>Contents of the Release</h2> + +<table CELLSPACING=0 CELLPADDING=0 > +<tr> +<td><tt>README.html </tt></td> + +<td>this file</td> +</tr> + +<tr> +<td><tt>junit.jar</tt></td> + +<td>a jar file with the JUnit framework and tools </td> +</tr> + +<tr> +<td>src.jar</td> + +<td>a jar file with the source code of the junit framework</td> +</tr> + +<tr> +<td><tt>junit</tt></td> + +<td>the source code of the JUnit samples</td> +</tr> + +<tr> +<td><tt> samples</tt></td> + +<td>sample test cases</td> +</tr> + +<tr> +<td><tt> tests</tt></td> + +<td>test cases for JUnit itself</td> +</tr> + +<tr> +<td><tt>javadoc</tt></td> + +<td>javadoc generated documentation</td> +</tr> + +<tr> +<td><tt>doc</tt></td> + +<td>documentation and articles</td> +</tr> </table> + <h2> -<font color="#000000"><a name="Installation"></a>Installation</font></h2> -<font color="#000000">Below are the installation steps for installing -JUnit: -</font> +<a NAME="Installation"></a>Installation</h2> +Below are the installation steps for installing JUnit: <ol> - <li> - <font color="#000000">unzip the junit.zip file</font></li> - <li> - <font color="#000000">add<i> </i><b>junit.jar</b> to the -CLASSPATH. For example: <tt>set -classpath=%classpath%;INSTALL_DIR\junit3\junit.jar</tt></font></li> - <li> - <font color="#000000">test the installation by using either the -batch or the graphical TestRunner +<li> +unzip the junit.zip file</li> + +<li> +add<i> </i><b>junit.jar</b> to the CLASSPATH. For example: <tt>set classpath=%classpath%;INSTALL_DIR\junit3\junit.jar</tt></li> + +<li> +test the installation by using either the batch or the graphical TestRunner tool to run the tests that come with this release. All the tests should -pass OK.</font></li> - <font color="#000000"><br> - <b><font color="#ff0000">Notice</font></b>: that the tests are not +pass OK.</li> + +<br><b><font color="#FF0000">Notice</font></b>: that the tests are not contained in the junit.jar but in the installation directory directly. -Therefore make sure that the installation directory is on the class -path - </font> - <ul> - <li> - <font color="#000000">for the batch TestRunner type:</font></li> - <font color="#000000"><br> - <tt> java junit.textui.TestRunner -junit.samples.AllTests</tt> - <li>for the graphical TestRunner type:</li> - <br> - <tt> java junit.awtui.TestRunner -junit.samples.AllTests</tt> - <li>for the Swing based graphical TestRunner type:</li> - <br> - <tt> java junit.swingui.TestRunner -junit.samples.AllTests</tt></font> - </ul> +Therefore make sure that the installation directory is on the class path +<ul> +<li> +for the batch TestRunner type:</li> + +<br><tt> java junit.textui.TestRunner junit.samples.AllTests</tt> +<li> +for the graphical TestRunner type:</li> + +<br><tt> java junit.awtui.TestRunner junit.samples.AllTests</tt> +<li> +for the Swing based graphical TestRunner type:</li> + +<br><tt> java junit.swingui.TestRunner junit.samples.AllTests</tt></ul> </ol> -<font color="#000000"><b><font color="#ff0000">Important</font></b>: -don't install the junit.jar +<b><font color="#FF0000">Important</font></b>: don't install the junit.jar into the extension directory of your JDK installation. If you do so the test class on the files system will not be found. -</font> -<h2><font color="#000000"><a name="Getting"></a>Getting Started</font></h2> -<font color="#000000">To get started with unit testing and JUnit read -the Java Report article: +<h2> +<a NAME="Getting"></a>Getting Started</h2> +To get started with unit testing and JUnit read the Java Report article: <a href="doc/testinfected/testing.htm">Test Infected - Programmers Love Writing Tests</a>. -<br> -This article demonstrates the development process with JUnit in the +<br>This article demonstrates the development process with JUnit in the context of multiple currency arithmetic. The corresponding source code is in junit\samples\money. -</font> -<p><font color="#000000">You find additional samples in the -junit.samples package: -</font></p> +<p>You find additional samples in the junit.samples package: <ul> - <li> - <font color="#000000">SimpleTest.java - some simple test cases</font></li> - <li> - <font color="#000000">VectorTest.java - test cases for -java.util.Vector</font></li> +<li> +SimpleTest.java - some simple test cases</li> + +<li> +VectorTest.java - test cases for java.util.Vector</li> </ul> + <h2> -<font color="#000000"><a name="Documentation"></a>Documentation</font></h2> -<blockquote><font color="#000000"><a href="doc/cookbook/cookbook.htm">JUnit -Cookbook</a> - <br> - A cookbook for implementing tests with JUnit. - <br> - <a href="doc/testinfected/testing.htm">Test Infected - Programmers +<a NAME="Documentation"></a>Documentation</h2> + +<blockquote><a href="doc/cookbook/cookbook.htm">JUnit Cookbook</a> +<br> A cookbook for implementing tests with JUnit. +<br><a href="doc/testinfected/testing.htm">Test Infected - Programmers Love Writing Tests</a> - <br> - An article demonstrating the development process +<br> An article demonstrating the development process with JUnit. - <br> - <a href="doc/cookstour/cookstour.htm">JUnit - A cooks tour</a> - <br> - <a href="javadoc/index.html">Javadoc</a> - <br> - API documentation generated with javadoc. - <br> - <a href="doc/faq/faq.htm">Frequently asked questions</a> - <br> - Some frequently asked questions about using JUnit. - <br> - <a href="doc/JUnitProperties.html">TestRunner Preference settings</a> - <br> - Describes the preferences settings that can be -configured +<br><a href="doc/cookstour/cookstour.htm">JUnit - A cooks tour</a> +<br><a href="javadoc/index.html">Javadoc</a> +<br> API documentation generated with javadoc. +<br><a href="doc/faq/faq.htm">Frequently asked questions</a> +<br> Some frequently asked questions about using JUnit. +<br><a href="doc/JUnitProperties.html">TestRunner Preference settings</a> +<br> Describes the preferences settings that can be configured for the JUnit TestRunners.<br> <a href="cpl-v10.html">License</a> - <br> - The terms of the common public license used for -JUnit.</font></blockquote> +<br> The terms of the common public license used for JUnit.</blockquote> + <h2> -<font color="#000000"><a name="Extending"></a>Extending JUnit</font></h2> -<font color="#000000">Examples of possible JUnit extensions can be -found in the <tt>junit.extensions</tt> +<a NAME="Extending"></a>Extending JUnit</h2> +Examples of possible JUnit extensions can be found in the <tt>junit.extensions</tt> package: -</font> <ul> - <li> - <font color="#000000"><a - href="javadoc/junit/extensions/TestDecorator.html">TestDecorator</a> -- A decorator for Test. You can use it as the base class for -implementing -decorators to extend test cases.</font></li> - <li> - <font color="#000000"><a - href="javadoc/junit/extensions/ActiveTestSuite.html">ActiveTestSuite</a> +<li> +<a href="javadoc/junit/extensions/TestDecorator.html">TestDecorator</a> +- A decorator for Test. You can use it as the base class for implementing +decorators to extend test cases.</li> + +<li> +<a href="javadoc/junit/extensions/ActiveTestSuite.html">ActiveTestSuite</a> - A TestSuite which runs each test in a separate thread and waits until -they are all terminated.</font></li> - <li> - <font color="#000000"><a - href="javadoc/junit/extensions/TestSetup.html">TestSetup</a> - A -Decorator -to set up and tear down additional fixture state. Subclass TestSetup -and +they are all terminated.</li> + +<li> +<a href="javadoc/junit/extensions/TestSetup.html">TestSetup</a> - A Decorator +to set up and tear down additional fixture state. Subclass TestSetup and insert it into your tests when you want to set up additional state once -before the tests are run.</font></li> - <li> - <font color="#000000"><a - href="javadoc/junit/extensions/ExceptionTestCase.html">ExceptionTestCase</a> -- A TestCase that expects a particular Exception to be thrown.</font></li> +before the tests are run.</li> + +<li> +<a href="javadoc/junit/extensions/ExceptionTestCase.html">ExceptionTestCase</a> +- A TestCase that expects a particular Exception to be thrown.</li> </ul> -<hr width="100%"> -<!--webbot bot="HTMLMarkup" startspan --><font color="#000000"><a - href="http://sourceforge.net"><img - src="http://sourceforge.net/sflogo.php?group_id=15278" width="88" - height="31" border="0" alt="SourceForge Logo"></a><!--webbot -bot="HTMLMarkup" endspan --></font> + +<hr WIDTH="100%"> +<!--webbot bot="HTMLMarkup" startspan --><a href="http://sourceforge.net"><IMG + src="http://sourceforge.net/sflogo.php?group_id=15278" + width="88" height="31" border="0" alt="SourceForge Logo"></a><!--webbot +bot="HTMLMarkup" endspan --> </body> </html> Index: .classpath =================================================================== RCS file: /cvsroot/junit/junit/.classpath,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- .classpath 17 Nov 2004 22:08:16 -0000 1.2 +++ .classpath 15 Feb 2006 22:55:28 -0000 1.3 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path=""/> + <classpathentry excluding="junit4.0*/**" kind="src" path=""/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path=""/> </classpath> |
From: David S. <ds...@us...> - 2006-02-15 22:56:11
|
Update of /cvsroot/junit/junit/junit/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/samples Modified Files: AllTests.java SimpleTest.java Added Files: ListTest.java Removed Files: VectorTest.java Log Message: Merged with branch, Kent will make final changes and launch. Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/junit/samples/AllTests.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AllTests.java 9 Sep 2004 21:53:54 -0000 1.2 +++ AllTests.java 15 Feb 2006 22:55:32 -0000 1.3 @@ -14,7 +14,7 @@ } public static Test suite ( ) { TestSuite suite= new TestSuite("All JUnit Tests"); - suite.addTest(VectorTest.suite()); + suite.addTest(ListTest.suite()); suite.addTest(new TestSuite(junit.samples.money.MoneyTest.class)); suite.addTest(junit.tests.AllTests.suite()); return suite; Index: SimpleTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/samples/SimpleTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- SimpleTest.java 9 Sep 2004 21:53:54 -0000 1.5 +++ SimpleTest.java 15 Feb 2006 22:55:32 -0000 1.6 @@ -12,6 +12,7 @@ protected int fValue1; protected int fValue2; + @Override protected void setUp() { fValue1= 2; fValue2= 3; --- VectorTest.java DELETED --- |
From: David S. <ds...@us...> - 2006-02-15 22:55:52
|
Update of /cvsroot/junit/junit/doc/faq In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/doc/faq Modified Files: faq.htm Log Message: Merged with branch, Kent will make final changes and launch. Index: faq.htm =================================================================== RCS file: /cvsroot/junit/junit/doc/faq/faq.htm,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- faq.htm 28 Dec 2004 17:19:01 -0000 1.30 +++ faq.htm 15 Feb 2006 22:55:39 -0000 1.31 @@ -62,20 +62,18 @@ --> <p> <i> -JUnit is an open source Java testing framework used to write and run -automated test. -<br/> -It is an instance of the xUnit architecture for unit -testing frameworks. +JUnit is a simple, open source framework to write and run repeatable +tests. It is an instance of the xUnit architecture for unit testing +frameworks. [...1552 lines suppressed...] - </p> - </li> - </ul> - </li> - <li> - <p> - <b><a name="extend_2"></a>What kinds of extensions are available?</b> - </p> - <p> - The JUnit home page has a complete list of available <a - href="http://www.junit.org/news/extension/index.htm">JUnit - extensions</a>. - </p> - </li> -</ol> - - <!-- Miscellaneous |