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: David S. <ds...@us...> - 2007-07-05 20:56:59
|
Update of /cvsroot/junit/junit-ant-tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2688/junit-ant-tests Log Message: Directory /cvsroot/junit/junit-ant-tests added to the repository |
From: Jonathan A. <jon...@gm...> - 2007-07-03 19:18:29
|
On 7/3/07, David Saff <sa...@mi...> wrote: > Jonathan, > > I have not used Spring directly, so learning a bit more will probably > help me in the future. Are you directly shutting down the application > contexts, or should that happen automatically at garbage collection? > If you create a lot of application contexts in a loop, do you see > similar results to what you saw for JUnit? You really only use one. It's the big container keeping all the objects. I have looked around a bit more and discovered that Spring actually have alot of classes made especially for JUnit 3 that helps with these kind of things. > JUnit 3 did indeed create all of the instance fields for all test > objects at once, but this is intentionally fixed in JUnit 4. Can you > give me an example of how your tests look that would help me figure > out whether JUnit can do something more to help your situation? What I meant in claiming that the problem is not really solved was based on this text: <http://www.symphonious.net/2006/09/19/junit-memory-usage-in-eclipse/> > David |
From: David S. <sa...@mi...> - 2007-07-03 18:57:02
|
Jonathan, I have not used Spring directly, so learning a bit more will probably help me in the future. Are you directly shutting down the application contexts, or should that happen automatically at garbage collection? If you create a lot of application contexts in a loop, do you see similar results to what you saw for JUnit? JUnit 3 did indeed create all of the instance fields for all test objects at once, but this is intentionally fixed in JUnit 4. Can you give me an example of how your tests look that would help me figure out whether JUnit can do something more to help your situation? David On 7/3/07, Jonathan Alvarsson <jon...@gm...> wrote: > It is the Spring application context. I solved it now by using just one > static reference to one aplication context instead so now I guess I have > quite some time until I will run out of memery next time... > > The principal problem still exists for JUnit though... > > > On 7/3/07, David Saff <sa...@mi...> wrote: > > (I accidentally dropped the thread from the list. CC'ing the list to > > get them up to date.) > > > > My best guess is that the "fork" being discussed is the option on the > > junit task in ant. > > > > What are you allocating memory-wise for each test? Thanks, > > > > David > > > > On 7/3/07, Jonathan Alvarsson <jon...@gm...> wrote: > > > On 6/28/07, David Saff <sa...@mi... > wrote: > > > > Jonathan, > > > > > > > > Are you using JUnit 3? If so, a move to JUnit 4 should help a lot. > > > > It will require a small amount of rewrite of the test code, but the > > > > memory usage profile should be much more reasonable. Thanks, > > > > > > Okey so I changed some code into JUnit 4 compatible. But this didn't > > > change much. It's still the same. When I run all tests in my package > > > the test run turns really slow after just about half of the tests but > > > those tests run at normal speed if runned separately... > > > > > > Someone said somthing about fork. Do you know anything about that? > > > > > > // Jonathan > > > > > > > > > -- > // Jonathan |
From: Jonathan A. <jon...@gm...> - 2007-07-03 18:41:11
|
It is the Spring application context. I solved it now by using just one static reference to one aplication context instead so now I guess I have quite some time until I will run out of memery next time... The principal problem still exists for JUnit though... On 7/3/07, David Saff <sa...@mi...> wrote: > > (I accidentally dropped the thread from the list. CC'ing the list to > get them up to date.) > > My best guess is that the "fork" being discussed is the option on the > junit task in ant. > > What are you allocating memory-wise for each test? Thanks, > > David > > On 7/3/07, Jonathan Alvarsson <jon...@gm...> wrote: > > On 6/28/07, David Saff <sa...@mi...> wrote: > > > Jonathan, > > > > > > Are you using JUnit 3? If so, a move to JUnit 4 should help a lot. > > > It will require a small amount of rewrite of the test code, but the > > > memory usage profile should be much more reasonable. Thanks, > > > > Okey so I changed some code into JUnit 4 compatible. But this didn't > > change much. It's still the same. When I run all tests in my package > > the test run turns really slow after just about half of the tests but > > those tests run at normal speed if runned separately... > > > > Someone said somthing about fork. Do you know anything about that? > > > > // Jonathan > > > -- // Jonathan |
From: David S. <sa...@mi...> - 2007-07-03 17:54:58
|
(I accidentally dropped the thread from the list. CC'ing the list to get them up to date.) My best guess is that the "fork" being discussed is the option on the junit task in ant. What are you allocating memory-wise for each test? Thanks, David On 7/3/07, Jonathan Alvarsson <jon...@gm...> wrote: > On 6/28/07, David Saff <sa...@mi...> wrote: > > Jonathan, > > > > Are you using JUnit 3? If so, a move to JUnit 4 should help a lot. > > It will require a small amount of rewrite of the test code, but the > > memory usage profile should be much more reasonable. Thanks, > > Okey so I changed some code into JUnit 4 compatible. But this didn't > change much. It's still the same. When I run all tests in my package > the test run turns really slow after just about half of the tests but > those tests run at normal speed if runned separately... > > Someone said somthing about fork. Do you know anything about that? > > // Jonathan > |
From: Soumya S P. <spa...@in...> - 2007-07-02 22:39:00
|
I will be out of the office starting 06/30/2007 and will not return until 07/15/2007. I will be out of the office starting 07/02/2007 and will not return until 07/13/2007. If you need immediate assistance, Batch Email - Manish Singh Supplier Response - So Ying Webless - Lokesh K Sharma Incase any emergency, reach me on +91 9810792402 |
From: Build A. <vim...@vi...> - 2007-07-02 21:18:14
|
BUILD result ------------------------------------------------------------ BUILD for junit (#35) on localhost was BROKEN: Script returned non-zero code "1" Build status: http://parabuild.viewtier.com:8080/parabuild/index.htm?view=detailed&buildid=5 Suspect Changes ------------------------------------------------------------ Change(s) by dsaff : - Fixed bug 1745048: @After method not called after my test ti; Time: 01:59 PM 07/02/2007; Change list: 7142 - - The hamcrest-core-1.1 library is now included in the JUnit; Time: 11:11 AM 07/02/2007; Change list: 7134 - - The hamcrest-core-1.1 library is now included in the JUnit; Time: 11:10 AM 07/02/2007; Change list: 7133 Change(s) Details: http://parabuild.viewtier.com:8080/parabuild/build/changes.htm?buildrunid=4480 BUILD logs ------------------------------------------------------------ BUILD log: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=6076 Error lines: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=6077 Log Lines Around Error ------------------------------------------------------------ [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/imposterization/ThrownMatcherTest.java:4: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/imposterization/ThrownMatcherTest.java:4: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:3: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.allOf; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:3: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.allOf; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:4: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:4: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:5: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.hasToString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:5: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.hasToString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:6: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.not; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:6: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.not; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:3: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.is; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:3: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.is; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:4: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.nullValue; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:4: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.nullValue; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/matchers/CamelCaseNameTest.java:3: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.is; BUILD FAILED [javac] ^ /opt/parabuild/etc/build/b5co/a/u/t/o/junit/build.xml:52: Compile failed; see the compiler error output for details. [javac] 100 errors Total time: 20 seconds Timings ------------------------------------------------------------ BUILD took 22 seconds |
From: David S. <ds...@us...> - 2007-07-02 21:00:01
|
Update of /cvsroot/junit/junit/src/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv512/src/org/junit/internal/runners Modified Files: MethodRoadie.java Log Message: Fixed bug 1745048: @After method not called after my test timeout in 4.3.1 Index: MethodRoadie.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/MethodRoadie.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MethodRoadie.java 2 Jul 2007 18:10:58 -0000 1.2 +++ MethodRoadie.java 2 Jul 2007 20:59:57 -0000 1.3 @@ -46,29 +46,37 @@ } private void runWithTimeout(long timeout) { - ExecutorService service= Executors.newSingleThreadExecutor(); - Callable<Object> callable= new Callable<Object>() { - public Object call() throws Exception { - runTest(); - return null; - } - }; - Future<Object> result= service.submit(callable); - service.shutdown(); try { - boolean terminated= service.awaitTermination(timeout, - TimeUnit.MILLISECONDS); - if (!terminated) - service.shutdownNow(); - result.get(0, TimeUnit.MILLISECONDS); // throws the exception if one occurred during the invocation - } catch (TimeoutException e) { - addFailure(new Exception(String.format("test timed out after %d milliseconds", timeout))); - } catch (Exception e) { - addFailure(e); - } + runBefores(); + ExecutorService service= Executors.newSingleThreadExecutor(); + Callable<Object> callable= new Callable<Object>() { + public Object call() throws Exception { + runTestMethod(); + return null; + } + }; + Future<Object> result= service.submit(callable); + service.shutdown(); + try { + boolean terminated= service.awaitTermination(timeout, + TimeUnit.MILLISECONDS); + if (!terminated) + service.shutdownNow(); + result.get(0, TimeUnit.MILLISECONDS); // throws the exception if one occurred during the invocation + } catch (TimeoutException e) { + addFailure(new Exception(String.format("test timed out after %d milliseconds", timeout))); + } catch (Exception e) { + addFailure(e); + } + } catch (FailedBefore e) { + } finally { + runAfters(); + } } public void runTest() { + // TODO (Jul 2, 2007 4:54:13 PM): duplicated in timeout branch? + try { runBefores(); runTestMethod(); |
From: David S. <ds...@us...> - 2007-07-02 21:00:01
|
Update of /cvsroot/junit/junit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv512 Modified Files: to-do.txt Log Message: Fixed bug 1745048: @After method not called after my test timeout in 4.3.1 Index: to-do.txt =================================================================== RCS file: /cvsroot/junit/junit/to-do.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- to-do.txt 2 Jul 2007 18:10:58 -0000 1.6 +++ to-do.txt 2 Jul 2007 20:59:57 -0000 1.7 @@ -24,4 +24,6 @@ * Theories class validation should be much better -* assumePasses doesn't have desired effect within a Theory \ No newline at end of file +* assumePasses doesn't have desired effect within a Theory + +* Find a way to make Parameterized a single-class extension \ No newline at end of file |
From: David S. <ds...@us...> - 2007-07-02 21:00:01
|
Update of /cvsroot/junit/junit/src/org/junit/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv512/src/org/junit/runners Modified Files: Parameterized.java Log Message: Fixed bug 1745048: @After method not called after my test timeout in 4.3.1 Index: Parameterized.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/runners/Parameterized.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Parameterized.java 2 Jul 2007 18:11:14 -0000 1.4 +++ Parameterized.java 2 Jul 2007 20:59:57 -0000 1.5 @@ -156,5 +156,3 @@ } } -// TODO: (Before June 2007) single-class this extension - |
From: David S. <ds...@us...> - 2007-07-02 21:00:00
|
Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv512/src/org/junit/tests Modified Files: TimeoutTest.java Log Message: Fixed bug 1745048: @After method not called after my test timeout in 4.3.1 Index: TimeoutTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/TimeoutTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- TimeoutTest.java 13 Dec 2006 02:10:51 -0000 1.5 +++ TimeoutTest.java 2 Jul 2007 20:59:57 -0000 1.6 @@ -1,6 +1,8 @@ package org.junit.tests; +import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -10,6 +12,7 @@ import junit.framework.JUnit4TestAdapter; import junit.framework.TestResult; +import org.junit.After; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.JUnitCore; @@ -138,4 +141,21 @@ new JUnit4TestAdapter(InfiniteLoopTest.class).run(result); assertEquals(1, result.errorCount()); } + + public static class WillTimeOut { + static boolean afterWasCalled= false; + + @Test(timeout=1) public void test() { + for(;;); + } + + @After public void after() { + afterWasCalled= true; + } + } + + @Test public void makeSureAfterIsCalledAfterATimeout() { + JUnitCore.runClasses(WillTimeOut.class); + assertThat(WillTimeOut.afterWasCalled, is(true)); + } } |
From: Build A. <vim...@vi...> - 2007-07-02 19:05:08
|
BUILD result ------------------------------------------------------------ BUILD for junit (#34) on localhost was BROKEN: Script returned non-zero code "1" Build status: http://parabuild.viewtier.com:8080/parabuild/index.htm?view=detailed&buildid=5 Suspect Changes ------------------------------------------------------------ Change(s) by dsaff : - - The hamcrest-core-1.1 library is now included in the JUnit; Time: 11:11 AM 07/02/2007; Change list: 7134 - - The hamcrest-core-1.1 library is now included in the JUnit; Time: 11:10 AM 07/02/2007; Change list: 7133 Change(s) Details: http://parabuild.viewtier.com:8080/parabuild/build/changes.htm?buildrunid=4474 BUILD logs ------------------------------------------------------------ BUILD log: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=6069 Error lines: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=6070 Log Lines Around Error ------------------------------------------------------------ [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/imposterization/ThrownMatcherTest.java:4: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/imposterization/ThrownMatcherTest.java:4: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:3: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.allOf; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:3: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.allOf; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:4: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:4: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.containsString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:5: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.hasToString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:5: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.hasToString; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:6: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.not; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/ConcreteFunctionTest.java:6: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.not; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:3: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.is; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:3: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.is; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:4: package org.hamcrest does not exist [javac] import static org.hamcrest.Matchers.nullValue; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/javamodel/FunctionTest.java:4: static import only from classes and interfaces [javac] import static org.hamcrest.Matchers.nullValue; [javac] ^ [javac] /opt/parabuild/etc/build/b5co/a/u/t/o/junit/src/org/junit/experimental/theories/test/matchers/CamelCaseNameTest.java:3: package org.hamcrest does not exist BUILD FAILED [javac] import static org.hamcrest.Matchers.is; /opt/parabuild/etc/build/b5co/a/u/t/o/junit/build.xml:52: Compile failed; see the compiler error output for details. [javac] ^ [javac] 100 errors Total time: 20 seconds Timings ------------------------------------------------------------ BUILD took 22 seconds |
From: David S. <ds...@us...> - 2007-07-02 18:11:50
|
Update of /cvsroot/junit/junit/src/org/junit/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/runners Modified Files: Parameterized.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: Parameterized.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/runners/Parameterized.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Parameterized.java 20 Mar 2007 14:43:50 -0000 1.3 +++ Parameterized.java 2 Jul 2007 18:11:14 -0000 1.4 @@ -156,5 +156,5 @@ } } -// TODO: single-class this extension +// TODO: (Before June 2007) single-class this extension |
From: David S. <ds...@us...> - 2007-07-02 18:11:50
|
Update of /cvsroot/junit/junit/src/org/junit/internal/requests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/internal/requests Modified Files: ClassRequest.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: ClassRequest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/requests/ClassRequest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ClassRequest.java 20 Mar 2007 14:43:51 -0000 1.7 +++ ClassRequest.java 2 Jul 2007 18:11:15 -0000 1.8 @@ -57,7 +57,7 @@ } public boolean hasSuiteMethod() { - // TODO: check all attributes + // TODO: (Before June 2007) check all attributes try { fTestClass.getMethod("suite"); } catch (NoSuchMethodException e) { |
From: David S. <ds...@us...> - 2007-07-02 18:11:45
|
Update of /cvsroot/junit/junit/src/org/junit/runner In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/runner Modified Files: Description.java Request.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: Description.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/runner/Description.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Description.java 26 Apr 2007 19:56:31 -0000 1.3 +++ Description.java 2 Jul 2007 18:11:11 -0000 1.4 @@ -48,6 +48,18 @@ } /** + * Create a <code>Description</code> of a single test named <code>name</code> in the class <code>clazz</code>. + * Generally, this will be a leaf <code>Description</code>. + * (This remains for binary compatibility with clients of JUnit 4.3) + * @param clazz the class of the test + * @param name the name of the test (a method name for test annotated with {@link org.junit.Test}) + * @return a <code>Description</code> named <code>name</code> + */ + public static Description createTestDescription(Class<?> clazz, String name) { + return createTestDescription(clazz, name, new Annotation[0]); + } + + /** * Create a <code>Description</code> named after <code>testClass</code> * @param testClass A {@link Class} containing tests * @return a <code>Description</code> of <code>testClass</code> Index: Request.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/runner/Request.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Request.java 27 Feb 2007 16:17:47 -0000 1.4 +++ Request.java 2 Jul 2007 18:11:11 -0000 1.5 @@ -86,7 +86,6 @@ return filterWith(new Filter() { @Override public boolean shouldRun(Description description) { - // TODO: test for equality even if we have children? if (description.isTest()) return desiredDescription.equals(description); for (Description each : description.getChildren()) |
From: David S. <ds...@us...> - 2007-07-02 18:11:44
|
Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/tests Modified Files: UserStopTest.java AllTests.java AssertionTest.java Added Files: AssumptionTest.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. --- NEW FILE: AssumptionTest.java --- package org.junit.tests; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; import static org.junit.Assume.assumeNoException; import static org.junit.Assume.assumeNotNull; import static org.junit.Assume.assumeThat; import org.hamcrest.Matchers; import org.junit.Assume; import org.junit.Test; import org.junit.Assume.AssumptionViolatedException; import org.junit.runner.JUnitCore; import org.junit.runner.Result; public class AssumptionTest { public static class HasFailingAssumption { @Test public void assumptionsFail() { assumeThat(3, is(4)); fail(); } } @Test public void failedAssumptionsMeanIgnore() { Result result= JUnitCore.runClasses(HasFailingAssumption.class); assertThat(result.getRunCount(), is(1)); assertThat(result.getIgnoreCount(), is(0)); assertThat(result.getFailureCount(), is(0)); } public static class HasPassingAssumption { @Test public void assumptionsFail() { assumeThat(3, is(3)); fail(); } } @Test public void passingAssumptionsScootThrough() { Result result= JUnitCore.runClasses(HasPassingAssumption.class); assertThat(result.getRunCount(), is(1)); assertThat(result.getIgnoreCount(), is(0)); assertThat(result.getFailureCount(), is(1)); } @Test(expected= AssumptionViolatedException.class) public void assumeThatWorks() { assumeThat(1, is(2)); } @Test public void assumeThatPasses() { assumeThat(1, is(1)); assertCompletesNormally(); } @Test public void assumeThatPassesOnStrings() { assumeThat("x", is("x")); assertCompletesNormally(); } @Test(expected= AssumptionViolatedException.class) public void assumeNotNullThrowsException() { Object[] objects= { 1, 2, null }; assumeNotNull(objects); } @Test public void assumeNotNullPasses() { Object[] objects= { 1, 2 }; assumeNotNull(objects); assertCompletesNormally(); } @Test public void assumeNotNullIncludesParameterList() { try { Object[] objects= { 1, 2, null }; assumeNotNull(objects); } catch (AssumptionViolatedException e) { assertThat(e.getMessage(), Matchers.containsString("1, 2, null")); } catch (Exception e) { fail("Should have thrown AssumptionViolatedException"); } } @Test public void assumeNoExceptionThrows() { final Throwable exception= new NullPointerException(); try { assumeNoException(exception); fail("Should have thrown exception"); } catch (AssumptionViolatedException e) { assertThat(e.getCause(), is(exception)); } } private void assertCompletesNormally() { } @Test(expected=AssumptionViolatedException.class) public void assumeTrueWorks() { Assume.assumeTrue(false); } } Index: UserStopTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/UserStopTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- UserStopTest.java 20 Mar 2007 14:43:49 -0000 1.2 +++ UserStopTest.java 2 Jul 2007 18:11:09 -0000 1.3 @@ -17,13 +17,6 @@ @Test(expected=StoppedByUserException.class) public void userStop() { fNotifier.fireTestStarted(null); } - - - // TODO: API is changing -// @Test(expected=StoppedByUserException.class) public void stopMethodRunner() throws Exception { -// new TestMethodRunner(this, OneTest.class.getMethod("foo"), fNotifier, -// Description.createTestDescription(OneTest.class, "foo")).run(); -// } public static class OneTest { @Test public void foo() {} Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AllTests.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- AllTests.java 26 Apr 2007 19:56:30 -0000 1.11 +++ AllTests.java 2 Jul 2007 18:11:09 -0000 1.12 @@ -11,10 +11,10 @@ @RunWith(Suite.class) @SuiteClasses({ + AssumptionTest.class, ClassRequestTest.class, ListenerTest.class, FailedConstructionTest.class, - // TODO: What did CVS do with this? CustomRunnerTest.class, TestDescriptionTest.class, SuiteDescriptionTest.class, AllTestsTest.class, Index: AssertionTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AssertionTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AssertionTest.java 26 Apr 2007 19:56:30 -0000 1.7 +++ AssertionTest.java 2 Jul 2007 18:11:09 -0000 1.8 @@ -4,7 +4,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; +import static org.hamcrest.CoreMatchers.equalTo; + +import java.math.BigDecimal; + import org.junit.Assert; import org.junit.ComparisonFailure; import org.junit.Test; @@ -118,11 +123,9 @@ assertArrayEquals(new long[] {1}, new long[] {1}); } - @Test - public void arraysContainingIntsAreEqualToArraysContainingLongs() { - Object[] int1= { 1, 2, 3 }; - Object[] int2= { 1L, 2L, 3L }; - assertArrayEquals(int1, int2); + @Test(expected=AssertionError.class) + public void IntegerDoesNotEqualLong() { + assertEquals(new Integer(1), new Long(1)); } @Test public void intsEqualLongs() { @@ -259,6 +262,15 @@ assertEquals(1.0, 2.0, 0.9); } + @Test(expected= AssertionError.class) public void floatsNotEqualWithoutDelta() { + assertEquals(1.0, 1.1); + } + + @Test(expected= AssertionError.class) public void bigDecimalsNotEqual() { + assertEquals(new BigDecimal("123.4"), new BigDecimal("123.0")); + } + + @Test(expected= AssertionError.class) public void doublesNotEqual() { assertEquals(1.0d, 2.0d, 0.9d); } @@ -384,4 +396,30 @@ assertEquals("expected: java.lang.String<4> but was: java.lang.Integer<4>", e.getMessage()); } } + + @Test public void assertThatIncludesDescriptionOfTestedValueInErrorMessage() { + String expected = "expected"; + String actual = "actual"; + + String expectedMessage = "identifier\nExpected: \"expected\"\n got: \"actual\"\n"; + + try { + assertThat("identifier", actual, equalTo(expected)); + } catch (AssertionError e) { + assertEquals(expectedMessage, e.getMessage()); + } + } + + @Test public void assertThatDescriptionCanBeElided() { + String expected = "expected"; + String actual = "actual"; + + String expectedMessage = "\nExpected: \"expected\"\n got: \"actual\"\n"; + + try { + assertThat(actual, equalTo(expected)); + } catch (AssertionError e) { + assertEquals(expectedMessage, e.getMessage()); + } + } } |
From: David S. <ds...@us...> - 2007-07-02 18:11:43
|
Update of /cvsroot/junit/junit/build/experimental-use-of-antunit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/build/experimental-use-of-antunit Modified Files: junit-slow.ant junit.properties macros.ant junit.ant Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: junit-slow.ant =================================================================== RCS file: /cvsroot/junit/junit/build/experimental-use-of-antunit/junit-slow.ant,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- junit-slow.ant 26 Apr 2007 20:21:21 -0000 1.3 +++ junit-slow.ant 2 Jul 2007 18:11:09 -0000 1.4 @@ -28,6 +28,11 @@ <au:assertFileExists file="${antdistdir}/org/junit/tests" /> </target> + <target name="testCharacterize_PopulateGeneratesSrcJar"> + <junitbuild target="populate-dist" /> + <au:assertFileExists file="${srcjarfile}" /> + </target> + <!-- DRIVING TESTS --> <target name="testPopulateDoesntRecursivelyInclude"> Index: junit.properties =================================================================== RCS file: /cvsroot/junit/junit/build/experimental-use-of-antunit/junit.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- junit.properties 26 Apr 2007 20:21:21 -0000 1.2 +++ junit.properties 2 Jul 2007 18:11:09 -0000 1.3 @@ -5,4 +5,5 @@ exttestjavadoczip=${junitdir}/${testjavadoczip} tempdir=tempdir test.jarfile=junit-test.version.jar -test.srcjarfile=junit-test.version-src.jar \ No newline at end of file +test.srcjarfile=junit-test.version-src.jar +test.hamcrestsrc=${antdist}/temp-hamcrest-for-ant-unit \ No newline at end of file Index: macros.ant =================================================================== RCS file: /cvsroot/junit/junit/build/experimental-use-of-antunit/macros.ant,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- macros.ant 26 Apr 2007 20:21:21 -0000 1.2 +++ macros.ant 2 Jul 2007 18:11:09 -0000 1.3 @@ -14,6 +14,7 @@ <macrodef name="junitbuild"> <attribute name="target" /> + <attribute name="javadocpackages" default="org.junit"/> <sequential> <ant antfile="build.xml" target="@{target}" dir="${junitdir}"> <property name="dist" value="${antdist}" /> @@ -21,9 +22,10 @@ value="${antdist}/ant-unit-java-docs" /> <property name="javadoczip" value="${testjavadoczip}" /> - <property name="javadocpackages" value="org.junit" /> + <property name="javadocpackages" value="@{javadocpackages}" /> <property name="binjar" value="${test.jarfile}" /> <property name="srcjar" value="${test.srcjarfile}" /> + <property name="hamcrestsrc" value="${test.hamcrestsrc}" /> </ant> </sequential> </macrodef> Index: junit.ant =================================================================== RCS file: /cvsroot/junit/junit/build/experimental-use-of-antunit/junit.ant,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- junit.ant 26 Apr 2007 20:21:21 -0000 1.3 +++ junit.ant 2 Jul 2007 18:11:09 -0000 1.4 @@ -82,11 +82,6 @@ <au:assertFileExists file="${binjarfile}" /> </target> - <target name="testCharacterize_PopulateGeneratesSrcJar"> - <junitbuild target="populate-dist" /> - <au:assertFileExists file="${srcjarfile}" /> - </target> - <target name="testCharacterize_PopulateCopiesSamplesAndTests"> <junitbuild target="samples-and-tests" /> <au:assertFileExists file="${antdistdir}/junit/samples" /> @@ -94,16 +89,39 @@ <au:assertFileExists file="${antdistdir}/org/junit/samples" /> <au:assertFileExists file="${antdistdir}/org/junit/tests" /> </target> + + <!-- TODO: shotgun to pass in hamcrestsrc --> + <target name="testCharacterize_UnjarHamcrestGeneratesSource"> + <junitbuild target="unjar.hamcrest" /> + + <!-- TODO: confused about where this directory is --> + <au:assertFileExists file="${junitdir}/${test.hamcrestsrc}/org/hamcrest" /> + </target> <!-- DRIVING TESTS --> - <target name="testJavaDocZip"> + <target name="testJavaDocZipCreatesOrgDir"> <junitbuild target="javadoczip" /> <au:assertFileExists file="${exttestjavadoczip}" /> <unzip.exttestjavadoczip /> <au:assertFileExists file="${tempdir}/org" /> </target> + + <!-- TODO: what hamcrest packages do I need? --> + <!-- TODO DUP above --> + <target name="testJavaDocZipCreatesHamcrestDir"> + <junitbuild target="javadoczip" javadocpackages="org.junit, org.hamcrest.core" /> + <au:assertFileExists file="${exttestjavadoczip}" /> + <unzip.exttestjavadoczip /> + <au:assertFileExists file="${tempdir}/org/hamcrest" /> + </target> + + <target name="testJavaDocHasNoErrors"> + <junitbuild target="javadoc" /> + <au:assertLogDoesntContain text="does not exist" /> + </target> + <target name="testJavaDocZipDeletedOnClean"> <touch file="${exttestjavadoczip}" /> <junitbuild target="clean" /> |
From: David S. <ds...@us...> - 2007-07-02 18:11:41
|
Update of /cvsroot/junit/junit/src/org/junit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit Modified Files: Assert.java Added Files: Assume.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. --- NEW FILE: Assume.java --- package org.junit; import static java.util.Arrays.asList; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.SelfDescribing; import org.hamcrest.StringDescription; import org.junit.experimental.theories.matchers.api.Each; public class Assume { public static class AssumptionViolatedException extends RuntimeException implements SelfDescribing { private static final long serialVersionUID= 1L; private final Object fValue; private final Matcher<?> fMatcher; public AssumptionViolatedException(Object value, Matcher<?> matcher) { super(value instanceof Throwable ? (Throwable) value : null); fValue= value; fMatcher= matcher; } @Override public String getMessage() { return StringDescription.asString(this); } public void describeTo(Description description) { description.appendText("got: "); description.appendValue(fValue); description.appendText(", expected: "); description.appendDescriptionOf(fMatcher); } } public static <T> void assumeThat(T value, Matcher<T> assumption) { if (!assumption.matches(value)) throw new AssumptionViolatedException(value, assumption); } public static void assumeNotNull(Object... objects) { assumeThat(asList(objects), Each.each(notNullValue())); } public static void assumeNoException(Throwable t) { assumeThat(t, nullValue()); } public static void assumeTrue(boolean b) { assumeThat(b, is(true)); } } Index: Assert.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/Assert.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Assert.java 26 Apr 2007 19:56:30 -0000 1.6 +++ Assert.java 2 Jul 2007 18:11:07 -0000 1.7 @@ -2,6 +2,9 @@ import java.lang.reflect.Array; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.StringDescription; import org.junit.internal.ArrayComparisonFailure; /** @@ -100,8 +103,6 @@ } private static boolean isEquals(Object expected, Object actual) { - if (expected instanceof Number && actual instanceof Number) - return ((Number) expected).longValue() == ((Number) actual).longValue(); return expected.equals(actual); } @@ -141,13 +142,11 @@ } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an - * {@link AssertionError} is thrown with the given message. If <code>expecteds</code> and - * <code>actuals</code> are <code>null</code>, they are considered equal. + * Asserts that two byte arrays are equal. If they are not, an + * {@link AssertionError} is thrown with the given message. * @param message the identifying message or <code>null</code> for the {@link AssertionError} - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values. - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * @param expecteds byte array with expected values. + * @param actuals byte array with actual values */ public static void assertArrayEquals(String message, byte[] expecteds, byte[] actuals) throws ArrayComparisonFailure { @@ -155,25 +154,21 @@ } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an {@link AssertionError} - * is thrown. If <code>expected</code> and <code>actual</code> are <code>null</code>, - * they are considered equal. - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * Asserts that two byte arrays are equal. If they are not, an + * {@link AssertionError} is thrown. + * @param expecteds byte array with expected values. + * @param actuals byte array with actual values */ public static void assertArrayEquals(byte[] expecteds, byte[] actuals) { assertArrayEquals(null, expecteds, actuals); } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an - * {@link AssertionError} is thrown with the given message. If <code>expecteds</code> and - * <code>actuals</code> are <code>null</code>, they are considered equal. + * Asserts that two char arrays are equal. If they are not, an + * {@link AssertionError} is thrown with the given message. * @param message the identifying message or <code>null</code> for the {@link AssertionError} - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values. - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * @param expecteds char array with expected values. + * @param actuals char array with actual values */ public static void assertArrayEquals(String message, char[] expecteds, char[] actuals) throws ArrayComparisonFailure { @@ -181,25 +176,21 @@ } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an {@link AssertionError} - * is thrown. If <code>expected</code> and <code>actual</code> are <code>null</code>, - * they are considered equal. - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * Asserts that two char arrays are equal. If they are not, an + * {@link AssertionError} is thrown. + * @param expecteds char array with expected values. + * @param actuals char array with actual values */ public static void assertArrayEquals(char[] expecteds, char[] actuals) { assertArrayEquals(null, expecteds, actuals); } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an - * {@link AssertionError} is thrown with the given message. If <code>expecteds</code> and - * <code>actuals</code> are <code>null</code>, they are considered equal. + * Asserts that two short arrays are equal. If they are not, an + * {@link AssertionError} is thrown with the given message. * @param message the identifying message or <code>null</code> for the {@link AssertionError} - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values. - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * @param expecteds short array with expected values. + * @param actuals short array with actual values */ public static void assertArrayEquals(String message, short[] expecteds, short[] actuals) throws ArrayComparisonFailure { @@ -207,25 +198,21 @@ } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an {@link AssertionError} - * is thrown. If <code>expected</code> and <code>actual</code> are <code>null</code>, - * they are considered equal. - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * Asserts that two short arrays are equal. If they are not, an + * {@link AssertionError} is thrown. + * @param expecteds short array with expected values. + * @param actuals short array with actual values */ public static void assertArrayEquals(short[] expecteds, short[] actuals) { assertArrayEquals(null, expecteds, actuals); } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an - * {@link AssertionError} is thrown with the given message. If <code>expecteds</code> and - * <code>actuals</code> are <code>null</code>, they are considered equal. + * Asserts that two int arrays are equal. If they are not, an + * {@link AssertionError} is thrown with the given message. * @param message the identifying message or <code>null</code> for the {@link AssertionError} - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values. - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * @param expecteds int array with expected values. + * @param actuals int array with actual values */ public static void assertArrayEquals(String message, int[] expecteds, int[] actuals) throws ArrayComparisonFailure { @@ -233,42 +220,36 @@ } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an {@link AssertionError} - * is thrown. If <code>expected</code> and <code>actual</code> are <code>null</code>, - * they are considered equal. - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * Asserts that two int arrays are equal. If they are not, an + * {@link AssertionError} is thrown. + * @param expecteds int array with expected values. + * @param actuals int array with actual values */ public static void assertArrayEquals(int[] expecteds, int[] actuals) { assertArrayEquals(null, expecteds, actuals); } /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an {@link AssertionError} - * is thrown. If <code>expected</code> and <code>actual</code> are <code>null</code>, - * they are considered equal. - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values - */ - public static void assertArrayEquals(long[] expecteds, long[] actuals) { - assertArrayEquals(null, expecteds, actuals); - } - - /** - * TODO: fix javadoc - * Asserts that two object arrays are equal. If they are not, an - * {@link AssertionError} is thrown with the given message. If <code>expecteds</code> and - * <code>actuals</code> are <code>null</code>, they are considered equal. + * Asserts that two long arrays are equal. If they are not, an + * {@link AssertionError} is thrown with the given message. * @param message the identifying message or <code>null</code> for the {@link AssertionError} - * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values. - * @param actuals Object array or array of arrays (multi-dimensional array) with actual values + * @param expecteds long array with expected values. + * @param actuals long array with actual values */ public static void assertArrayEquals(String message, long[] expecteds, long[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); } + + /** + * Asserts that two long arrays are equal. If they are not, an + * {@link AssertionError} is thrown. + * @param expecteds long array with expected values. + * @param actuals long array with actual values + */ + public static void assertArrayEquals(long[] expecteds, long[] actuals) { + assertArrayEquals(null, expecteds, actuals); + } /** * Asserts that two object arrays are equal. If they are not, an @@ -333,7 +314,23 @@ if (!(Math.abs(expected - actual) <= delta)) failNotEquals(message, new Double(expected), new Double(actual)); } + + static public void assertEquals(long expected, long actual) { + assertEquals(null, expected, actual); + } + + static public void assertEquals(String message, long expected, long actual) { + assertEquals(message, (Long)expected, (Long)actual); + } + static public void assertEquals(double expected, double actual) { + assertEquals(null, expected, actual); + } + + static public void assertEquals(String message, double expected, double actual) { + fail("Use assertEquals(expected, actual, delta) to compare floating-point numbers"); + } + /** * Asserts that two doubles or floats are equal to within a positive delta. If they * are not, an {@link AssertionError} is thrown. If the @@ -490,4 +487,19 @@ assertArrayEquals(expecteds, actuals); } + + public static <T> void assertThat(T actual, Matcher<T> matcher) { + assertThat("", actual, matcher); + } + + public static <T> void assertThat(String reason, T actual, Matcher<T> matcher) { + if (!matcher.matches(actual)) { + Description description = new StringDescription(); + description.appendText(reason); + description.appendText("\nExpected: "); + matcher.describeTo(description); + description.appendText("\n got: ").appendValue(actual).appendText("\n"); + throw new java.lang.AssertionError(description.toString()); + } + } } |
From: David S. <ds...@us...> - 2007-07-02 18:11:32
|
Update of /cvsroot/junit/junit/src/junit/runner In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/junit/runner Modified Files: Version.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: Version.java =================================================================== RCS file: /cvsroot/junit/junit/src/junit/runner/Version.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Version.java 26 Apr 2007 19:56:31 -0000 1.3 +++ Version.java 2 Jul 2007 18:10:58 -0000 1.4 @@ -9,7 +9,7 @@ } public static String id() { - return "4.4-snapshot-20070322-1027"; + return "4.4-snapshot-20070629-0646"; } public static void main(String[] args) { |
From: David S. <ds...@us...> - 2007-07-02 18:11:32
|
Update of /cvsroot/junit/junit/src/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/internal/runners Modified Files: MethodRoadie.java JUnit4ClassRunner.java TestMethod.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: MethodRoadie.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/MethodRoadie.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MethodRoadie.java 20 Mar 2007 14:43:50 -0000 1.1 +++ MethodRoadie.java 2 Jul 2007 18:10:58 -0000 1.2 @@ -10,23 +10,22 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import org.junit.Assume.AssumptionViolatedException; import org.junit.runner.Description; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunNotifier; public class MethodRoadie { private final Object fTest; - private final Method fMethod; private final RunNotifier fNotifier; private final Description fDescription; private TestMethod fTestMethod; - public MethodRoadie(Object test, Method method, RunNotifier notifier, Description description, TestClass testClass) { + public MethodRoadie(Object test, TestMethod method, RunNotifier notifier, Description description) { fTest= test; - fMethod= method; fNotifier= notifier; fDescription= description; - fTestMethod= new TestMethod(method, testClass); + fTestMethod= method; } public void run() { @@ -81,12 +80,14 @@ protected void runTestMethod() { try { - fMethod.invoke(fTest); + fTestMethod.invoke(fTest); if (fTestMethod.expectsException()) addFailure(new AssertionError("Expected exception: " + fTestMethod.getExpectedException().getName())); } catch (InvocationTargetException e) { Throwable actual= e.getTargetException(); - if (!fTestMethod.expectsException()) + if (actual instanceof AssumptionViolatedException) + return; + else if (!fTestMethod.expectsException()) addFailure(actual); else if (fTestMethod.isUnexpected(actual)) { String message= "Unexpected exception, expected<" + fTestMethod.getExpectedException().getName() + "> but was<" Index: JUnit4ClassRunner.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/JUnit4ClassRunner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- JUnit4ClassRunner.java 26 Apr 2007 19:56:31 -0000 1.2 +++ JUnit4ClassRunner.java 2 Jul 2007 18:10:58 -0000 1.3 @@ -23,10 +23,14 @@ public JUnit4ClassRunner(Class<?> klass) throws InitializationError { fTestClass= new TestClass(klass); - fTestMethods= fTestClass.getTestMethods(); + fTestMethods= getTestMethods(); validate(); } + protected List<Method> getTestMethods() { + return fTestClass.getTestMethods(); + } + protected void validate() throws InitializationError { MethodValidator methodValidator= new MethodValidator(fTestClass); methodValidator.validateMethodsForDefaultRunner(); @@ -69,21 +73,23 @@ } protected void invokeTestMethod(Method method, RunNotifier notifier) { + Description description= methodDescription(method); Object test; try { test= createTest(); } catch (InvocationTargetException e) { - notifier.testAborted(methodDescription(method), e.getCause()); + notifier.testAborted(description, e.getCause()); return; } catch (Exception e) { - notifier.testAborted(methodDescription(method), e); + notifier.testAborted(description, e); return; } - createMethodRunner(test, method, notifier).run(); + TestMethod testMethod= wrapMethod(method); + new MethodRoadie(test, testMethod, notifier, description).run(); } - protected MethodRoadie createMethodRunner(Object test, Method method, RunNotifier notifier) { - return new MethodRoadie(test, method, notifier, methodDescription(method), fTestClass); + protected TestMethod wrapMethod(Method method) { + return new TestMethod(method, fTestClass); } protected String testName(Method method) { @@ -91,8 +97,7 @@ } protected Description methodDescription(Method method) { - Description result= Description.createTestDescription(getTestClass().getJavaClass(), testName(method), testAnnotations(method)); - return result; + return Description.createTestDescription(getTestClass().getJavaClass(), testName(method), testAnnotations(method)); } protected Annotation[] testAnnotations(Method method) { Index: TestMethod.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/TestMethod.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TestMethod.java 20 Mar 2007 14:43:50 -0000 1.3 +++ TestMethod.java 2 Jul 2007 18:10:58 -0000 1.4 @@ -1,5 +1,6 @@ package org.junit.internal.runners; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; @@ -10,7 +11,6 @@ import org.junit.Test.None; public class TestMethod { - private final Method fMethod; private TestClass fTestClass; @@ -25,13 +25,15 @@ public long getTimeout() { Test annotation= fMethod.getAnnotation(Test.class); + if (annotation == null) + return 0; long timeout= annotation.timeout(); return timeout; } - Class<? extends Throwable> getExpectedException() { + protected Class<? extends Throwable> getExpectedException() { Test annotation= fMethod.getAnnotation(Test.class); - if (annotation.expected() == None.class) + if (annotation == null || annotation.expected() == None.class) return null; else return annotation.expected(); @@ -53,4 +55,8 @@ return fTestClass.getAnnotatedMethods(After.class); } + public void invoke(Object test) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { + fMethod.invoke(test); + } + } |
From: David S. <ds...@us...> - 2007-07-02 18:11:32
|
Update of /cvsroot/junit/junit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902 Modified Files: build.xml to-do.txt .classpath Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: build.xml =================================================================== RCS file: /cvsroot/junit/junit/build.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- build.xml 8 May 2007 14:45:18 -0000 1.28 +++ build.xml 2 Jul 2007 18:10:57 -0000 1.29 @@ -1,6 +1,6 @@ <project name="junit" default="dist" basedir="."> <tstamp /> - + <property file="${user.home}/.junit.properties" /> <property name="src" value="src" /> <property name="bin" value="bin" /> @@ -14,8 +14,10 @@ <property name="srcjar" value="junit-${version}-src.jar" /> <property name="javadocdir" value="${dist}/javadoc" /> <property name="javadoczip" value="${dist}-javadoc.zip" /> - <property name="javadocpackages" value="org.junit, org.junit.runner, org.junit.runner.description, org.junit.runner.manipulation, org.junit.runner.notification, org.junit.runners" /> - + <property name="javadocpackages" value="org.junit, org.junit.runner, org.junit.runner.description, org.junit.runner.manipulation, org.junit.runner.notification, org.junit.runners, org.hamcrest.core" /> + <property name="hamcrestlib" value="lib/hamcrest-core-SNAPSHOT.jar" /> + <property name="hamcrestsrc" value="${dist}/temp.hamcrest.source" /> + <target name="init"> <tstamp/> </target> @@ -46,11 +48,15 @@ srcdir="${src}" destdir="${bin}" debug="on" + classpath="${hamcrestlib}" > <compilerarg value="-Xlint:unchecked" /> + <classpath /> </javac> + + <unjar src="${hamcrestlib}" dest="${bin}" /> </target> - + <target name="jars"> <mkdir dir="${dist}" /> <jar @@ -72,17 +78,22 @@ </copy> </target> - <target name="javadoc"> - <mkdir dir="${javadocdir}" /> - <javadoc sourcepath="${src}" - packagenames="${javadocpackages}" + <target name="unjar.hamcrest"> + <unjar src="${hamcrestlib}" dest="${hamcrestsrc}" /> + </target> + + <target name="javadoc" depends="unjar.hamcrest"> + <javadoc packagenames="${javadocpackages}" destdir="${javadocdir}" author="false" version="false" use="false" windowtitle="JUnit API" stylesheetfile="stylesheet.css" - /> + > + <sourcepath location="${src}" /> + <sourcepath location="${hamcrestsrc}" /> + </javadoc> </target> <target name="javadoczip"> @@ -90,7 +101,7 @@ <antcall target="javadoc" /> <zip basedir="${javadocdir}" file="${javadoczip}" /> </target> - + <target name="populate-dist" depends="clean, build, jars, samples-and-tests, javadoc" > Index: to-do.txt =================================================================== RCS file: /cvsroot/junit/junit/to-do.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- to-do.txt 24 Jan 2007 16:32:59 -0000 1.5 +++ to-do.txt 2 Jul 2007 18:10:58 -0000 1.6 @@ -1,4 +1,3 @@ -* What happened to CustomRunnerTest? * assertArrayEquals(double[], double[], double) and assertArrayEquals(float[], float[], float) * update documentation @@ -17,4 +16,12 @@ * Automatically add failing tests to the Known Defects section of the README.html * Create test target in ant -* Organize org.junit.tests \ No newline at end of file +* Organize org.junit.tests +* Create assume(that()) and assert(that()) + (what is a better name for the second one?) + +* Simplify implementation of equality, and organize AssertionTest + +* Theories class validation should be much better + +* assumePasses doesn't have desired effect within a Theory \ No newline at end of file Index: .classpath =================================================================== RCS file: /cvsroot/junit/junit/.classpath,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- .classpath 22 Nov 2006 06:29:43 -0000 1.10 +++ .classpath 2 Jul 2007 18:10:58 -0000 1.11 @@ -1,6 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_01"/> + <classpathentry kind="lib" path="lib/hamcrest-core-1.1.jar"/> + <classpathentry kind="lib" path="testlib/hamcrest-library-SNAPSHOT.jar"/> + <classpathentry kind="lib" path="testlib/jmock-2.2.0-RC1.jar"/> + <classpathentry kind="lib" path="testlib/cglib-nodep-2.2_beta1.jar"/> + <classpathentry kind="lib" path="testlib/objenesis-1.0.jar"/> <classpathentry kind="output" path="bin"/> </classpath> |
From: David S. <ds...@us...> - 2007-07-02 18:11:26
|
Update of /cvsroot/junit/junit/src/org/junit/experimental/theories/test/assertion In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/experimental/theories/test/assertion Added Files: AssumptionViolatedExceptionTest.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. --- NEW FILE: AssumptionViolatedExceptionTest.java --- package org.junit.experimental.theories.test.assertion; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.hasToString; import static org.junit.Assert.assertThat; import org.hamcrest.Matcher; import org.hamcrest.Matchers; import org.hamcrest.StringDescription; import org.junit.Test; import org.junit.Assume.AssumptionViolatedException; import org.junit.experimental.theories.methods.api.Theory; import org.junit.experimental.theories.runner.api.Theories; import org.junit.runner.RunWith; @RunWith(Theories.class) public class AssumptionViolatedExceptionTest { public static Object TWO= 2; public static Matcher<?> IS_THREE= is(3); @Theory public void toStringIsUseful(Object actual, Matcher<?> matcher) { assertThat(new AssumptionViolatedException(actual, matcher).toString(), hasToString(Matchers.containsString(matcher.toString()))); } @Test public void AssumptionViolatedExceptionDescribesItself() { AssumptionViolatedException e= new AssumptionViolatedException(3, is(2)); assertThat(StringDescription.asString(e), is("got: <3>, expected: is <2>")); } } |
From: David S. <ds...@us...> - 2007-07-02 18:11:23
|
Update of /cvsroot/junit/junit/src/org/junit/runner/notification In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/runner/notification Modified Files: RunListener.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. Index: RunListener.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/runner/notification/RunListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- RunListener.java 21 Nov 2006 18:53:37 -0000 1.1 +++ RunListener.java 2 Jul 2007 18:11:17 -0000 1.2 @@ -75,7 +75,6 @@ */ public void testIgnored(Description description) throws Exception { } - } |
From: David S. <ds...@us...> - 2007-07-02 18:11:21
|
Update of /cvsroot/junit/junit/src/org/junit/experimental/theories/runner In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/src/org/junit/experimental/theories/runner Added Files: ParameterizedAssertionError.java TheoryContainerReference.java Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. --- NEW FILE: ParameterizedAssertionError.java --- /** * */ package org.junit.experimental.theories.runner; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; public class ParameterizedAssertionError extends RuntimeException { private static final long serialVersionUID = 1L; public ParameterizedAssertionError(Throwable targetException, String methodName, Object... params) { super(String.format("%s(%s)", methodName, join(", ", params)), targetException); } @Override public boolean equals(Object obj) { return toString().equals(obj.toString()); } public static String join(String delimiter, Object... params) { return join(delimiter, Arrays.asList(params)); } public static String join(String delimiter, Collection<Object> values) { StringBuffer buffer = new StringBuffer(); Iterator<Object> iter = values.iterator(); while (iter.hasNext()) { Object next = iter.next(); buffer.append(String.valueOf(next)); if (iter.hasNext()) { buffer.append(delimiter); } } return buffer.toString(); } } --- NEW FILE: TheoryContainerReference.java --- /** * */ package org.junit.experimental.theories.runner; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import org.junit.Assume.AssumptionViolatedException; import org.junit.experimental.theories.javamodel.api.ConcreteFunction; import org.junit.experimental.theories.methods.api.ParameterSignature; import org.junit.experimental.theories.methods.api.ParameterSupplier; import org.junit.experimental.theories.runner.api.Theories.TheoryMethod; public class TheoryContainerReference { private final Object container; public TheoryContainerReference(Object target) { this.container= target; } public int invoke(TheoryMethod method, Object[] params) throws Throwable { try { getTheoryFunction(method).invoke(params); } catch (AssumptionViolatedException e) { method.addAssumptionFailure(e); return 0; } catch (Throwable e) { if (params.length == 0) throw e; throw new ParameterizedAssertionError(e, method.getMethod() .getName(), params); } return 1; } private ConcreteFunction getTheoryFunction(TheoryMethod method) { return new ConcreteFunction(container, method.getMethod()); } public List<?> getPotentialValues(ParameterSignature sig) throws InstantiationException, IllegalAccessException { return getSupplier(sig).getValues(container, sig); } private ParameterSupplier getSupplier(ParameterSignature sig) throws InstantiationException, IllegalAccessException { ParameterSupplier supplier= getAnnotatedSupplier(sig); if (supplier != null) return supplier; return fieldParameterSupplier(); } private ParameterSupplier getAnnotatedSupplier(ParameterSignature sig) throws InstantiationException, IllegalAccessException { Annotation annotation= sig.getSupplierAnnotation(); if (annotation != null) return sig.getSupplier(annotation).value().newInstance(); return null; } private ParameterSupplier fieldParameterSupplier() { return new ParameterSupplier() { @Override public List<Object> getValues(Object test, ParameterSignature sig) { ArrayList<Object> list= new ArrayList<Object>(); for (Field field : container.getClass().getFields()) { if (sig.canAcceptField(field)) { try { list.add(field.get(test)); } catch (IllegalArgumentException e) { throw new RuntimeException( "unexpected: field from getClass doesn't exist on object"); } catch (IllegalAccessException e) { throw new RuntimeException( "unexpected: getFields returned an inaccessible field"); } } } for (Method method : container.getClass().getMethods()) { if (method.getParameterTypes().length == 0 && sig.canAcceptMethod(method)) { try { list.add(method.invoke(test)); } catch (IllegalArgumentException e) { throw new RuntimeException( "unexpected: argument length is checked"); } catch (IllegalAccessException e) { throw new RuntimeException( "unexpected: getMethods returned an inaccessible method"); } catch (InvocationTargetException e) { // do nothing, just look for more values } } } return list; } }; } public int runWithParameters(TheoryMethod method, List<Object> values, List<ParameterSignature> sigs) throws Throwable { if (sigs.size() == 0) { return invoke(method, values.toArray()); } int count= 0; for (Object value : getPotentialValues(sigs.get(0))) { if (value != null || method.nullsOk()) count+= runWithParameters(method, concat(values, value), sigs .subList(1, sigs.size())); } return count; } private List<Object> concat(List<Object> values, Object value) { ArrayList<Object> list= new ArrayList<Object>(); list.addAll(values); list.add(value); return list; } } |
From: David S. <ds...@us...> - 2007-07-02 18:11:21
|
Update of /cvsroot/junit/junit/build/experimental-use-of-antunit/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27902/build/experimental-use-of-antunit/lib Added Files: hamcrest-SNAPSHOT.zip Log Message: - The hamcrest-core-1.1 library is now included in the JUnit distribution. For more hamcrest matchers, see the hamcrest-library jar from http://code.google.com/p/hamcrest - The Popper Theory runner (http://popper.tigris.org) has been absorbed into the JUnit project, under the package name org.junit.experimental.theories - Several additional libraries used in the theories tests have been added in a new testlib directory - New "assertThat" statement to work with hamcrest matchers: // same as assertEquals(3, x) assertThat(x, is(3)); // same as assertNull(y) assertThat(y, nullValue()); - New feature: assumeThat. A failed assumption will cause the test to pass, without further execution. (The behavior of assumeThat may change in the future to allow richer reporting of tests that are skipped because of failed assumptions) // pass on any non-Windows system @Test public void getRootDrive() { assumeThat(getOsString(), is("Windows")); getFile("C:\"); // ... } - Convenience assumption functions: // none of these are null assumeNotNull(a, b, c); assumeTrue(everythingOk()); try { getDatabaseConnection(); } catch (Exception e) { assumeNoException(e); } - Documentation fixed for many assertEquals array methods - Two bugs in numeric equality fixed: 1718905: assertEquals does not compare float correctly 1715326: assertEquals does not compare java.math.BigDecimal properly - The protocol for overriding JUnit4ClassRunner has changed again. Please see the source for details. - Extenders can now extend TestMethod to describe the behavior of running methods that do not have a @Test annotation. - Adding Annotations to Description caused a binary compatibility problem with clients compiled on previous JUnit versions. This has been fixed. --- NEW FILE: hamcrest-SNAPSHOT.zip --- PK Lí]ûÑ®m mc,¿ ³ YL=¤5øWÔ)ýQmR y³IÑ8[Ò "êK+2L'81£ÿLpgÈô¬£ó¬ÂW¡WøÕÕ2K¹þW=¹½2alλ;ì¸éúîú-ɦv¬ ~,Ó$YHCÀ©Ïd1N¿Ê47c2af3µióz;o»óÂ&Ý{VL©Å5*z¨>ús¤bDâæV¡l¤ñ¬ÜWdï-® ¼@kmºN¼Ã {=´=¼®i0ÅZ\TÒ`ì ,iÍæ gפÊ\"ïI¾£?Ä.ûN4=òsUTIÖ«Öà <s?Úôä¥7êyOð'Üà¨èè®6v#1RZ%»Î"cc>ÃͳٱöTÛ¨T>¨XÌå¡AqjéW\kãÝ n¢¯aÏ#D»þPK {E.æ'wÏ~¶×]¡éÍ´~WÐdý ~Kà8,Ì4ÝDë\(RÕJïäóVVO"ã-÷¤sNiµÝK±Î5åUq©nK-ŲÖ.¾0 Î/¡ÀÊ}ñ[É¢JØl4ÀKVjÁUB¢L:å:! PYi*ÄFh<ÓUXm£jE.Ó¿ÙRBïãJèÒÀÆhˤi]0IÛZn+ÅÉËJ&6<[Äx©ãHå¬(>v%^ü\.9T²eÁ/Lå §Úû¹âÖ ©-O ?ðvÜ'WPÅÿ©ñEÊØ¹¢¯ÿ T0´|>Bª^*-t9«*Y+.DÊÕßTT>ýÕ' Ð,0a¡\É8ZÖJÜD©¹õVª|ÀwH*z³pU·È¨{êcù'´Ë9î1æÿ>-æQH-Õ÷ïÀõM*ùºk^¦ÜW+³?`^Bù¢¼lÓµ®ý ër¼[Ü$ÄXö$¼ðëc,×e ©¥y]2ÇúÿPK [...6214 lines suppressed...] |