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-02-21 14:44:15
|
Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11474/src/org/junit/tests Modified Files: ValidationTest.java SortableTest.java ForwardCompatibilityTest.java InitializationErrorForwardCompatibilityTest.java Log Message: Removed EmptyDescription, which was unneeded, and the only reason why Description had a protected constructor Index: ValidationTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/ValidationTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ValidationTest.java 21 Nov 2006 18:53:34 -0000 1.1 +++ ValidationTest.java 21 Feb 2007 14:44:00 -0000 1.2 @@ -1,9 +1,8 @@ package org.junit.tests; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.internal.runners.EmptyDescription; import org.junit.internal.runners.InitializationError; import org.junit.internal.runners.TestClassRunner; import org.junit.runner.Description; @@ -24,7 +23,7 @@ new TestClassRunner(WrongBeforeClass.class, new Runner() { @Override public Description getDescription() { - return new EmptyDescription(); + return Description.EMPTY; } @Override Index: SortableTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/SortableTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SortableTest.java 21 Nov 2006 18:53:33 -0000 1.1 +++ SortableTest.java 21 Feb 2007 14:44:00 -0000 1.2 @@ -1,12 +1,11 @@ package org.junit.tests; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import java.util.Comparator; import org.junit.Before; import org.junit.Test; -import org.junit.internal.runners.EmptyDescription; import org.junit.internal.runners.InitializationError; import org.junit.internal.runners.TestClassRunner; import org.junit.runner.Description; @@ -100,7 +99,7 @@ @Override public Description getDescription() { - return new EmptyDescription(); + return Description.EMPTY; } @Override Index: ForwardCompatibilityTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/ForwardCompatibilityTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ForwardCompatibilityTest.java 21 Nov 2006 18:53:33 -0000 1.1 +++ ForwardCompatibilityTest.java 21 Feb 2007 14:44:00 -0000 1.2 @@ -11,7 +11,6 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.internal.runners.EmptyDescription; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runner.Runner; @@ -199,7 +198,7 @@ @Override public Description getDescription() { - return new EmptyDescription(); + return Description.EMPTY; } } Index: InitializationErrorForwardCompatibilityTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/InitializationErrorForwardCompatibilityTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- InitializationErrorForwardCompatibilityTest.java 21 Nov 2006 18:53:33 -0000 1.1 +++ InitializationErrorForwardCompatibilityTest.java 21 Feb 2007 14:44:00 -0000 1.2 @@ -1,15 +1,12 @@ package org.junit.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import junit.framework.AssertionFailedError; import junit.framework.JUnit4TestAdapter; import junit.framework.TestListener; import junit.framework.TestResult; import org.junit.Before; import org.junit.Test; -import org.junit.internal.runners.EmptyDescription; import org.junit.internal.runners.TestClassRunner; import org.junit.runner.Description; import org.junit.runner.RunWith; @@ -26,7 +23,7 @@ @Override public Description getDescription() { - return new EmptyDescription(); + return Description.EMPTY; } @Override |
From: David S. <ds...@us...> - 2007-02-21 14:44:13
|
Update of /cvsroot/junit/junit/src/org/junit/runner In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11474/src/org/junit/runner Modified Files: Description.java Log Message: Removed EmptyDescription, which was unneeded, and the only reason why Description had a protected constructor Index: Description.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/runner/Description.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Description.java 21 Nov 2006 18:53:40 -0000 1.1 +++ Description.java 21 Feb 2007 14:44:00 -0000 1.2 @@ -41,10 +41,9 @@ public static Description createTestDescription(Class<?> clazz, String name) { return new Description(String.format("%s(%s)", name, clazz.getName())); } - + /** - * Create a generic <code>Description</code> that says there are tests in <code>testClass</code>. - * This is used as a last resort when you cannot precisely describe the individual tests in the class. + * 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> */ @@ -52,11 +51,16 @@ return new Description(testClass.getName()); } - public static Description TEST_MECHANISM = new Description("Test mechanism"); + public static final Description EMPTY= new Description("No Tests"); + public static final Description TEST_MECHANISM= new Description("Test mechanism"); + private final ArrayList<Description> fChildren= new ArrayList<Description>(); private final String fDisplayName; - - //TODO we seem to be using the static factories exclusively + + /** + * @deprecated (since 4.3) use the static factories (createTestDescription, createSuiteDescription) instead + */ + @Deprecated protected Description(final String displayName) { fDisplayName= displayName; } |
From: David S. <ds...@us...> - 2007-02-21 14:44:11
|
Update of /cvsroot/junit/junit/src/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11474/src/org/junit/internal/runners Removed Files: EmptyDescription.java Log Message: Removed EmptyDescription, which was unneeded, and the only reason why Description had a protected constructor --- EmptyDescription.java DELETED --- |
From: Butash, B. <bob...@ed...> - 2007-02-08 20:19:20
|
Hello, We're trying to update from JUnit 3.8.1 to Junit 4.2. We have many old JUnit classes that will need to remain, we will use the new feature for new classes. When I pulled in the new libraries I received compiler errors due to the junit.swingui.TestRunner no longer being available. I know there were some class loader difficulties with the class, however some of our older tests used this approach instead of a pure text based approach. For the most part it seems like the older classes were retained, I'm just curious as to why this class was removed. Thanks |
From: David S. <sa...@mi...> - 2007-02-08 17:56:42
|
Johan, Good luck with your thesis. I'd love to see a draft one day. I had a similar question, when an accident left me with an embarrassment of riches. Gump is Apache's large-scale integration testing framework. I broke the JUnit build one day, and got the following list of projects that also broke. This is an interesting place to start looking for projects to work on. It's possible that the Gump web page would have more information about where to look for URLs for each of these. Good luck, David Saff Project junit has an issue affecting its community integration. This issue affects 354 projects, and has been outstanding for 4 runs. The current state of this project is 'Failed', with reason 'Build Failed'. For reference only, the following projects are affected by this: - JacORB : The free Java implementation of the OMG's CORBA standard. - addressing : WS-FX Project - ant-contrib : Useful little Ant tasks - ant-contrib-cpptasks-test : JUnit tests for the C/C++ compilation tasks - ant-contrib-test : Useful little Ant tasks - ant-embed-optional : Java based build tool - ant-testutil : Java based build tool - ant-xdocs-proposal : Java based build tool - antbook-diary-core : Examples to go with Java Development with Ant - antbook-sections : Examples to go with Java Development with Ant - antunit-test : Task and Type Libraries for Apache Ant - apache-ldapber-provider : Apache Directory Project - apacheds-core : Apache Directory Server - apacheds-main : Apache Directory Server - apacheds-shared : Apache Directory Server - apollo : Apollo Project - args4j-tests : Java command line options parser - asn1-ber : Apache ASN.1 Tools - asn1-codec : Apache ASN.1 Tools - asn1-der : Apache ASN.1 Tools - authx-example : Apache Authentication and Authorization Framework - authx-script : Apache Authentication and Authorization Framework - avalon-framework-api : Avalon SVN - avalon-framework-impl : Avalon SVN - avalon-logkit : Avalon SVN - avalon-meta-api : Avalon SVN - avalon-meta-impl : Avalon SVN - avalon-meta-spi : Avalon SVN - avalon-meta-tools : Avalon SVN - avalon-util-configuration : Avalon SVN - avalon-util-i18n : Avalon SVN - cargo : Cargo provides a Java API to manipulate Java Containers - castor : Java to XML, SQL, LDAP bindings - checkstyle : Java style checker - commons-attributes : Commons Attributes - commons-beanutils : Bean Utilities (Core) - commons-beanutils-bean-collections : Bean Utilities (Bean Collections) - commons-beanutils-core : Jakarta commons - commons-betwixt : Commons Betwixt Package - commons-chain : GoF "Chain of Responsibility" pattern - commons-codec : Commons Encoding/Decoding Package - commons-compress : Commons Compression Package - commons-configuration : Jakarta commons - commons-dbcp : Database Connection Pool - commons-digester : XML to Java Object Configuration - commons-digester-rss : Digester RSS Example - commons-email : Commons Email Package - commons-fileupload : Commons File Upload Package - commons-functor : Functor: Function Objects - commons-graph : Jakarta commons dormant - sandbox components which are inact... - commons-httpclient : HTTP Client Library - commons-httpclient-2.0-branch : HTTP Client Library - commons-id : Commons Identifier Package - commons-io : Commons I/O Utility Package - commons-javaflow : Commons Javaflow - commons-jci : Commons JCI - commons-jelly : Commons Jelly - commons-jelly-tags-ant : Commons Jelly - commons-jelly-tags-antlr : Commons Jelly - commons-jelly-tags-avalon : Commons Jelly - commons-jelly-tags-bean : Commons Jelly - commons-jelly-tags-beanshell : Commons Jelly - commons-jelly-tags-betwixt : Commons Jelly - commons-jelly-tags-bsf : Commons Jelly - commons-jelly-tags-define : Commons Jelly - commons-jelly-tags-define-test : Commons Jelly - commons-jelly-tags-dynabean : Commons Jelly - commons-jelly-tags-email : Commons Jelly - commons-jelly-tags-fmt : Commons Jelly - commons-jelly-tags-fmt-test : Commons Jelly - commons-jelly-tags-html : Commons Jelly - commons-jelly-tags-http : Commons Jelly - commons-jelly-tags-interaction : Commons Jelly - commons-jelly-tags-jetty : Commons Jelly - commons-jelly-tags-jface : Commons Jelly - commons-jelly-tags-jms : Commons Jelly - commons-jelly-tags-jmx : Commons Jelly - commons-jelly-tags-jsl : Commons Jelly - commons-jelly-tags-jsl-test : Commons Jelly - commons-jelly-tags-junit : Commons Jelly - commons-jelly-tags-log : Commons Jelly - commons-jelly-tags-memory : Commons Jelly - commons-jelly-tags-ojb : Commons Jelly - commons-jelly-tags-quartz : Commons Jelly - commons-jelly-tags-regexp : Commons Jelly - commons-jelly-tags-sql : Commons Jelly - commons-jelly-tags-swing : Commons Jelly - commons-jelly-tags-swt : Commons Jelly - commons-jelly-tags-threads : Commons Jelly - commons-jelly-tags-util : Commons Jelly - commons-jelly-tags-validate : Commons Jelly - commons-jelly-tags-velocity : Commons Jelly - commons-jelly-tags-xml : Commons Jelly - commons-jelly-tags-xml-test : Commons Jelly - commons-jelly-tags-xmlunit : Commons Jelly - commons-jelly-test : Commons Jelly - commons-jexl : Commons Jexl Package - commons-jjar : Jakarta Jar Archive Repository - commons-jux : JUX: JUnit Extensions - commons-jxpath : XPath traversal of JavaBeans - commons-math : The Jakarta Mathematics Library - commons-messenger : A web based JMS framework - commons-modeler : Modeler MBeans - commons-net : Commons Net - commons-openpgp : Commons OpenPGP - commons-pool : Object Pooling - commons-primitives : Provides a collection of types and utilities optimized for w... - commons-services : Basic Services Architecture - commons-test : Commons Test Package - commons-transaction : Commons Identifier Package - commons-validator : Validation Framework - commons-vfs : Jakarta commons - commons-vfs-sandbox : Jakarta commons - commons-xmlio : XML Im-/Exporter is a low level library to assist you in the... - db-ddlutils : Easy-to-use component for working with Database Definition (... - db-ojb : ObjectRelationalBridge - db-ojb-from-packages : ObjectRelationalBridge - db-torque : Persistence Layer - derby : Apache Derby, 100% Java relational database. - derby-split-6 : Apache Derby, 100% Java relational database. - derby-split-7 : Apache Derby, 100% Java relational database. - derby-split-8 : Apache Derby, 100% Java relational database. - dom4j : The flexible XML framework for Java - dom4j-HEAD : The flexible XML framework for Java - dom4j-HEAD-tests : The flexible XML framework for Java - dom4j-tests : The flexible XML framework for Java - dotnet-antlib-test : Task and Type Libraries for Apache Ant - dumbster : The Dumbster is a very simple fake SMTP server designed for ... - excalibur-component : Repository of reusable components. - excalibur-cornerstone-connection-api : Repository of reusable components. - excalibur-cornerstone-connection-impl : Repository of reusable components. - excalibur-cornerstone-datasources-impl : Repository of reusable components. - excalibur-cornerstone-scheduler-impl : Repository of reusable components. - excalibur-cornerstone-sockets-impl : Repository of reusable components. - excalibur-cornerstone-store-impl : Repository of reusable components. - excalibur-cornerstone-threads-api : Repository of reusable components. - excalibur-cornerstone-threads-impl : Repository of reusable components. - excalibur-datasource : Repository of reusable components. - excalibur-event : Repository of reusable components. - excalibur-event-api : Repository of reusable components. - excalibur-event-impl : Repository of reusable components. - excalibur-fortress-bean : Repository of reusable components. - excalibur-fortress-container-api : Repository of reusable components. - excalibur-fortress-container-impl : Repository of reusable components. - excalibur-fortress-container-test : Repository of reusable components. - excalibur-fortress-examples : Repository of reusable components. - excalibur-fortress-meta : Repository of reusable components. - excalibur-fortress-migration : Repository of reusable components. - excalibur-fortress-platform : Repository of reusable components. - excalibur-fortress-testcase : Repository of reusable components. - excalibur-framework-impl : Repository of reusable components. - excalibur-instrument-api : Repository of reusable components. - excalibur-instrument-client : Repository of reusable components. - excalibur-instrument-mgr-api : Repository of reusable components. - excalibur-instrument-mgr-http : Repository of reusable components. - excalibur-instrument-mgr-impl : Repository of reusable components. - excalibur-lifecycle-api : Repository of reusable components. - excalibur-lifecycle-impl : Repository of reusable components. - excalibur-logger : Repository of reusable components. - excalibur-monitor : Repository of reusable components. - excalibur-pool : Repository of reusable components. - excalibur-pool-api : Repository of reusable components. - excalibur-pool-impl : Repository of reusable components. - excalibur-pool-instrumented : Repository of reusable components. - excalibur-sourceresolve : Repository of reusable components. - excalibur-store : Repository of reusable components. - excalibur-testcase : Repository of reusable components. - excalibur-thread : Repository of reusable components. - excalibur-thread-api : Repository of reusable components. - excalibur-thread-impl : Repository of reusable components. - excalibur-thread-impl-test : Repository of reusable components. - excalibur-thread-instrumented : Repository of reusable components. - excalibur-xmlutil : Repository of reusable components. - eyebrowse : Web-based mail archive browsing - forrest-whiteboard-forrestdoc : Apache Forrest is an XML standards-oriented documentation fr... - forrest-whiteboard-forrestdoc-autotest : Apache Forrest is an XML standards-oriented documentation fr... - fulcrum-bsf : Services Framework - fulcrum-cache : Services Framework - fulcrum-configuration-impl : Services Framework - fulcrum-crypto : Services Framework - fulcrum-dvsl : Services Framework - fulcrum-factory : Services Framework - fulcrum-hsqldb : Services Framework - fulcrum-intake : Services Framework - fulcrum-localization : Services Framework - fulcrum-mimetype : Services Framework - fulcrum-naming : Services Framework - fulcrum-osworkflow : Services Framework - fulcrum-parser : Services Framework - fulcrum-pool : Services Framework - fulcrum-quartz : Services Framework - fulcrum-security-api : Services Framework - fulcrum-security-memory : Services Framework - fulcrum-security-nt : Services Framework - fulcrum-template : Services Framework - fulcrum-testcontainer : Services Framework - fulcrum-upload : Services Framework - fulcrum-xmlrpc : Services Framework - fulcrum-xslt : Services Framework - fulcrum-yaafi : Services Framework - groovy : New agile dynamic language using a Java-like syntax for the ... - gsbase : A collection of java utility classes - gsbase-test : A collection of java utility classes - hivemind : HiveMind is a services and configuration microkernel - hivemind-compile : HiveMind is a services and configuration microkernel - hivemind-library : HiveMind is a services and configuration microkernel - htmlparser-test : HTML Parser - htmlunit : A tool for testing web based applications - httpunit : framework for unit testing web sites - invicta : Open-source build management tool. - ivy : Ivy Core - ivy-tests : Ivy is a tool for managing (recording, tracking, resolving a... - j2ee-xbeans : Apollo Project - jakarta-cactus-documentation : Cactus Documentation - jakarta-cactus-framework-12 : Cactus Framework (J2EE 1.2) - jakarta-cactus-framework-13 : Cactus Framework (J2EE 1.3) - jakarta-cactus-release-12 : Unit test framework for server-side java code - jakarta-cactus-release-13 : Unit test framework for server-side java code - jakarta-cactus-sample-jetty-13 : Cactus Jetty Sample (J2EE 1.3) - jakarta-cactus-sample-servlet-12 : Cactus Servlet Sample (J2EE 1.2) - jakarta-cactus-sample-servlet-13 : Cactus Servlet Sample (J2EE 1.3) - jakarta-jmeter-22-svn : Pure Java load testing and performance measurement tool. ... - jakarta-jmeter-22-test : Pure Java load testing and performance measurement tool. ... - jakarta-lucene : Java Based Search Engine - jakarta-poi : POI - jakarta-slide : Content Management System based on WebDAV technology - jakarta-taglibs-jmstags : JMS Taglib - jakarta-taglibs-xtags : XTags Taglib - jakarta-tomcat : Servlet 2.2 and JSP 1.1 Reference Implementation - jakarta-tomcat-4.0 : Servlet 2.3 and JSP 1.2 Reference Implementation - jakarta-tomcat-catalina : Servlet 2.4 Reference Implementation - jakarta-tomcat-coyote : Connectors to various web servers - jakarta-tomcat-coyote-tomcat3 : Connectors to various web servers - jakarta-tomcat-coyote-tomcat4 : Connectors to various web servers - jakarta-tomcat-dbcp : Servlet 2.4 and JSP 2.0 Reference Implementation - jakarta-tomcat-http11 : Connectors to various web servers - jakarta-tomcat-jk : Connectors to various web servers - jakarta-turbine-2 : A servlet based framework. - jakarta-turbine-jcs : Cache - james-server : James Server - java-service-wrapper : Java Service Wrapper - javagroups : A Reliable Multicast Communication Toolkit for Java - jaxen : Universal Java XPath Engine - jaxen-test : Universal Java XPath Engine - jdbm : Lightweight embeddable DB engine. - jetty : Java HTTP Servlet Server - jetty-plus : Java HTTP Servlet Server - jgroups : A Reliable Multicast Communication Toolkit for Java - jline-full - jmdns : ZeroConf implementation - junit : Unit test framework - junit-addons : Various JUnit addons and helper classes. - kerberos-common : Apache Directory Project - kerberos-protocol : Apache Kerberos Server - ldap-common : Apache Directory Project - ldap-protocol : Apache Directory Server - ldap-snacc-provider : Apache Directory Project - logging-log4cxx-ant : Apache log4cxx - logging-log4cxx-ant-no_wchar_t : Apache log4cxx - logging-log4cxx-ant-static : Apache log4cxx - logging-log4j-chainsaw : Chainsaw log viewer - lucene-java : Java Based Search Engine - magic : Avalon Tools. - maven : Project Management Tools - maven-bootstrap : Project Management Tools - maven-directory-plugin : Apache Directory Server - mina : A Multipurpose Infrastrusture for Network Applications - muse : Muse Project - mx4j : OpenSource implementation of a JMX agent - mx4j-tools : OpenSource implementation of a JMX agent - mx4j-tools-from-packaged-jetty : OpenSource implementation of a JMX agent - myfaces : JavaServer(tm) Faces implementation - naming-config : Apache Directory Naming Component - naming-core : Apache Directory Naming Component - naming-factory : Apache Directory Naming Component - naming-java : Apache Directory Naming Component - naming-management : Apache Directory Naming Component - naming-resources : Apache Directory Naming Component - opensaml : OpenSAML 1.0.1 is a set of open source Java and C++ librarie... - portals-bridges-common : Support for JSR168 compliant Portlet development - portals-bridges-frameworks : Support for JSR168 compliant Portlet development - portals-bridges-jsf : Support for JSR168 compliant Portlet development - portals-bridges-struts : Support for JSR168 compliant Portlet development - portals-bridges-velocity : Support for JSR168 compliant Portlet development - portals-jetspeed-1 : Enterprise Information Portal - portals-pluto-api-1.0 : JSR168 Container - portals-pluto-container-1.0 : JSR168 Container - portals-pluto-deploy-1.0 : JSR168 Container - portals-pluto-descriptors-1.0 : JSR168 Container - portals-pluto-portal-1.0 : JSR168 Container - quartz : Job Scheduler - rhino : JavaScript for Java - slide-webdavclient : Content Management System based on WebDAV technology - smartfrog : Smartfrog: Application Deployment from HP Laboratories - smartfrog-components : Smartfrog: Application Deployment from HP Laboratories - smartfrog-tasks : Smartfrog: Application Deployment from HP Laboratories - smartfrog-tasks-test : Smartfrog: Application Deployment from HP Laboratories - smartfrog-test : Smartfrog: Application Deployment from HP Laboratories - smartfrog-testharness : Smartfrog: Application Deployment from HP Laboratories - struts-sslext : The Struts SSL Extension for HTTP/HTTPS switching - strutstestcase : An extension of the standard JUnit TestCase class that provi... - stub-compiler : Apache ASN.1 Tools - svn-antlib-test : Task and Type Libraries for Apache Ant - tapestry : Component-based web application framework organized around i... - test-ant : Java based build tool - test-ant-no-xerces : Java based build tool - test-ojb : ObjectRelationalBridge - tomcat-catalina : Servlet 2.3 and JSP 1.2 Reference Implementation - tomcat-tc6 : Java Servlet 2.5 & Server Pages JSP 2.1 implementation (for ... - tomcat-tc6-dbcp : Java Servlet 2.5 & Server Pages JSP 2.1 implementation (for ... - velocity-dvsl : Template engine - velocity-tools : VelocityTools project - ws-axis : Apache eXtensible Interaction System - ws-axis-test : Apache eXtensible Interaction System - ws-axis2 : Apache Axis2 SOAP Stack - ws-commons-axiom : Common stuff for the WS projects. - ws-commons-policy : Common stuff for the WS projects. - ws-commons-xmlschema : Common stuff for the WS projects. - ws-juddi : ws-juddi -- UDDI Toolkit/Repository - ws-juddi-test : ws-juddi -- UDDI Toolkit/Repository - ws-wsif : Web Services Invocation Framework - wsa-xbeans : Apollo Project - wsrf-jndi-config : Apollo Project - wsrf-xbeans : Apollo Project - wss4j : WS-FX Project - xdoclet : Enhanced Doclet engine. - xdoclet-apache-module-prepare : Intermediate target that prepares xdoclet's apache modul... - xdoclet-bea-module-prepare : Intermediate target that prepares xdoclet's bea module - xdoclet-compile-core : Intermediate target that compiles xdoclet's core classes - xdoclet-ejb-module-prepare : Intermediate target that prepares xdoclet's ejb module - xdoclet-hibernate-module-prepare : Intermediate target that prepares xdoclet's hibernate mo... - xdoclet-jdo-module-prepare : Intermediate target that prepares xdoclet's jdo module - xdoclet-libelis-module-prepare : Intermediate target that prepares xdoclet's libelis modu... - xdoclet-objectweb-module-prepare : Intermediate target that prepares xdoclet's objectweb mo... - xdoclet-oracle-module-prepare : Intermediate target that prepares xdoclet's oracle modul... - xdoclet-orion-module-prepare : Intermediate target that prepares xdoclet's orion module - xdoclet-tjdo-module-prepare : Intermediate target that prepares xdoclet's tjdo module - xdoclet-web-module-prepare : Intermediate target that prepares xdoclet's web module - xdoclet-xdoclet-module-prepare : Intermediate target that prepares xdoclet's xdoclet modu... - xjavadoc : Enhanced Doclet engine. - xml-axis : Apache eXtensible Interaction System - xml-axis-wsif : Web Services Invocation Framework - xml-fop : XSL-FO (Formatting Objects) processor - xml-fop-maintenance : XSL-FO (Formatting Objects) processor (Maintenance branch) - xml-security-tests : XML-Signature Syntax and Processing - xml-xindice : native XML database - xml-xmlbeans-v1 : XML Beans Object <-> Java Binding Tool - xmlgraphics-commons : Apache XML Graphics Commons - Common Components for Batik an... - xmlrpc : A Java implementation of XML-RPC - xmlunit : JUnit extension for XML unit tests. - xom : XOM is a new XML object model. - xpp : XML Pull Parser - xpp3 : XML Pull Parser - xstream : simple library to serialize object to XML and back again On 2/8/07, Johan Nilsson <joh...@ds...> wrote: > Hi! > > We are working with our master thesis where we will perform an > experiment on different test case prioritization techniques. In the > experiment we will use JUnit test cases and are now looking for open > source software using these to use in our work. > > Do any of you have suggestions on software to use? > > Best regards > Johan Nilsson > Sara Qvarforth > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Junit-devel mailing list > Jun...@li... > https://lists.sourceforge.net/lists/listinfo/junit-devel > |
From: Johan N. <joh...@ds...> - 2007-02-08 09:46:45
|
Hi! We are working with our master thesis where we will perform an experiment on different test case prioritization techniques. In the experiment we will use JUnit test cases and are now looking for open source software using these to use in our work. Do any of you have suggestions on software to use? Best regards Johan Nilsson Sara Qvarforth |
From: David S. <ds...@us...> - 2007-01-26 14:04:25
|
Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1069/src/org/junit/tests Modified Files: AllTests.java Log Message: Eclipse thinks commas at the end of array initialization expressions are OK. Javac disagrees. Moved in favor of javac Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AllTests.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- AllTests.java 24 Jan 2007 16:32:59 -0000 1.6 +++ AllTests.java 26 Jan 2007 14:04:13 -0000 1.7 @@ -41,12 +41,10 @@ InaccessibleBaseClassTest.class, SuiteMethodTest.class, TestClassMethodsRunnerTest.class, - IgnoreClassTest.class, + IgnoreClassTest.class }) -public class AllTests { -// public static class Compatibility { - public static Test suite() { - return new JUnit4TestAdapter(AllTests.class); - } -// } +public class AllTests { + public static Test suite() { + return new JUnit4TestAdapter(AllTests.class); + } } |
From: David S. <ds...@us...> - 2007-01-24 16:33:11
|
Update of /cvsroot/junit/junit/src/org/junit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11688/src/org/junit Modified Files: Ignore.java Assert.java Log Message: Can @Ignore classes assertArrayEquals added Index: Ignore.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/Ignore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Ignore.java 21 Nov 2006 18:53:34 -0000 1.1 +++ Ignore.java 24 Jan 2007 16:32:59 -0000 1.2 @@ -22,7 +22,7 @@ * */ @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) +@Target({ElementType.METHOD, ElementType.TYPE}) public @interface Ignore { /** * The optional reason why the test is ignored. Index: Assert.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/Assert.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Assert.java 21 Nov 2006 19:52:30 -0000 1.2 +++ Assert.java 24 Jan 2007 16:32:59 -0000 1.3 @@ -1,5 +1,7 @@ package org.junit; +import java.lang.reflect.Array; + import org.junit.internal.ArrayComparisonFailure; /** @@ -87,7 +89,7 @@ static public void assertEquals(String message, Object expected, Object actual) { if (expected == null && actual == null) return; - if (expected != null && expected.equals(actual)) + if (expected != null && isEquals(expected, actual)) return; else if (expected instanceof String && actual instanceof String) { String cleanMessage= message == null ? "" : message; @@ -97,6 +99,12 @@ failNotEquals(message, expected, actual); } + 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); + } + /** * Asserts that two objects are equal. If they are not, an {@link AssertionError} * without a message is thrown. If <code>expected</code> and <code>actual</code> @@ -116,38 +124,11 @@ * @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 assertEquals(String message, Object[] expecteds, Object[] actuals) { - if (expecteds == actuals) - return; - String header = message == null ? "" : message + ": "; - if (expecteds == null) - fail(header + "expected array was null"); - if (actuals == null) - fail(header + "actual array was null"); - if (actuals.length != expecteds.length) - fail(header + "array lengths differed, expected.length=" + expecteds.length + " actual.length=" + actuals.length); - - for (int i= 0; i < expecteds.length; i++) { - Object o1= expecteds[i]; - Object o2= actuals[i]; - if (o1.getClass().isArray() && o2.getClass().isArray()) { - Object[] expected= (Object[]) o1; - Object[] actual= (Object[]) o2; - try { - assertEquals(message, expected, actual); - } catch (ArrayComparisonFailure e) { - e.addDimension(i); - throw e; - } - } else - try { - assertEquals(o1, o2); - } catch (AssertionError e) { - throw new ArrayComparisonFailure(header, e, i); - } - } + public static void assertArrayEquals(String message, Object[] expecteds, + Object[] actuals) throws ArrayComparisonFailure { + internalArrayEquals(message, expecteds, actuals); } - + /** * 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>, @@ -155,87 +136,183 @@ * @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 assertEquals(Object[] expecteds, Object[] actuals) { - assertEquals(null, expecteds, actuals); + public static void assertArrayEquals(Object[] expecteds, Object[] actuals) { + assertArrayEquals(null, expecteds, actuals); } /** - * Asserts that two longs are equal. If they are not - * an {@link AssertionError} is thrown with the given message. + * 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. + * @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 */ - static public void assertEquals(String message, long expected, long actual) { - assertEquals(message, Long.valueOf(expected), Long.valueOf(actual)); + public static void assertArrayEquals(String message, byte[] expecteds, + byte[] actuals) throws ArrayComparisonFailure { + internalArrayEquals(message, 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(byte[] expecteds, byte[] actuals) { + assertArrayEquals(null, expecteds, actuals); } /** - * Asserts that two longs are equal. + * 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. + * @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 */ - static public void assertEquals(long expected, long actual) { - assertEquals(null, expected, actual); + public static void assertArrayEquals(String message, char[] expecteds, + char[] actuals) throws ArrayComparisonFailure { + internalArrayEquals(message, 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(char[] expecteds, char[] actuals) { + assertArrayEquals(null, expecteds, actuals); } /** - * Asserts that two bytes are equal. If they are not - * an {@link AssertionError} is thrown with the given message. + * 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. + * @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 */ - static public void assertEquals(String message, byte expected, byte actual) { - assertEquals(message, Byte.valueOf(expected), Byte.valueOf(actual)); + public static void assertArrayEquals(String message, short[] expecteds, + short[] actuals) throws ArrayComparisonFailure { + internalArrayEquals(message, expecteds, actuals); } - + /** - * Asserts that two bytes are equal. + * 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 */ - static public void assertEquals(byte expected, byte actual) { - assertEquals(null, expected, actual); + public static void assertArrayEquals(short[] expecteds, short[] actuals) { + assertArrayEquals(null, expecteds, actuals); } /** - * Asserts that two chars are equal. If they are not - * an {@link AssertionError} is thrown with the given message. + * 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. + * @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 */ - static public void assertEquals(String message, char expected, char actual) { - assertEquals(message, Character.valueOf(expected), Character.valueOf(actual)); - } - + public static void assertArrayEquals(String message, int[] expecteds, + int[] actuals) throws ArrayComparisonFailure { + internalArrayEquals(message, expecteds, actuals); + } + /** - * Asserts that two chars are equal. + * 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 */ - static public void assertEquals(char expected, char actual) { - assertEquals(null, expected, actual); + public static void assertArrayEquals(int[] expecteds, int[] actuals) { + assertArrayEquals(null, expecteds, actuals); } - + /** - * Asserts that two shorts are equal. If they are not - * an {@link AssertionError} is thrown with the given message. + * 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 */ - static public void assertEquals(String message, short expected, short actual) { - assertEquals(message, Short.valueOf(expected), Short.valueOf(actual)); + public static void assertArrayEquals(long[] expecteds, long[] actuals) { + assertArrayEquals(null, expecteds, actuals); } - /** - * Asserts that two shorts are equal. + /** + * 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. + * @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 */ - static public void assertEquals(short expected, short actual) { - assertEquals(null, expected, actual); + public static void assertArrayEquals(String message, long[] expecteds, + long[] actuals) throws ArrayComparisonFailure { + internalArrayEquals(message, expecteds, actuals); } /** - * Asserts that two ints are equal. If they are not - * an {@link AssertionError} is thrown with the given message. - */ - static public void assertEquals(String message, int expected, int actual) { - assertEquals(message, Integer.valueOf(expected), Integer.valueOf(actual)); - } - - /** - * Asserts that two ints are equal. + * 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. + * @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 */ - static public void assertEquals(int expected, int actual) { - assertEquals(null, expected, actual); - } + private static void internalArrayEquals(String message, Object expecteds, + Object actuals) throws ArrayComparisonFailure { + if (expecteds == actuals) + return; + String header = message == null ? "" : message + ": "; + if (expecteds == null) + fail(header + "expected array was null"); + if (actuals == null) + fail(header + "actual array was null"); + int actualsLength= Array.getLength(actuals); + int expectedsLength= Array.getLength(expecteds); + if (actualsLength != expectedsLength) + fail(header + "array lengths differed, expected.length=" + expectedsLength + " actual.length=" + actualsLength); + for (int i= 0; i < expectedsLength; i++) { + Object expected= Array.get(expecteds, i); + Object actual= Array.get(actuals, i); + if (expected.getClass().isArray() && actual.getClass().isArray()) { + try { + internalArrayEquals(message, expected, actual); + } catch (ArrayComparisonFailure e) { + e.addDimension(i); + throw e; + } + } else + try { + assertEquals(expected, actual); + } catch (AssertionError e) { + throw new ArrayComparisonFailure(header, e, i); + } + } + } + /** - * Asserts that two doubles are equal to within a positive delta. If they + * Asserts that two doubles or floats are equal to within a positive delta. If they * are not, an {@link AssertionError} is thrown with the given message. If the * expected value is infinity then the delta value is ignored. NaNs are * considered equal: @@ -254,7 +331,7 @@ } /** - * Asserts that two doubles are equal to within a positive delta. If they + * Asserts that two doubles or floats are equal to within a positive delta. If they * are not, an {@link AssertionError} is thrown. If the * expected value is infinity then the delta value is ignored.NaNs are * considered equal: @@ -269,40 +346,6 @@ } /** - * Asserts that two floats are equal to within a positive delta. If they - * are not, an {@link AssertionError} is thrown with the given message. If the - * expected value is infinity then the delta value is ignored. NaNs are - * considered equal: - * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes - * @param message the identifying message or <code>null</code> for the {@link AssertionError} - * @param expected the expected float value - * @param actual the float value to check against <code>expected</code> - * @param delta the maximum delta between <code>expected</code> and <code>actual</code> for which - * both numbers are still considered equal. - */ - static public void assertEquals(String message, float expected, float actual, float delta) { - if (Float.compare(expected, actual) == 0) - return; - if (!(Math.abs(expected - actual) <= delta)) - failNotEquals(message, new Float(expected), new Float(actual)); - } - - /** - * Asserts that two floats are equal to within a positive delta. If they - * are not, an {@link AssertionError} is thrown. If the - * expected value is infinity then the delta value is ignored. {@link Float#NaN NaNs} are - * considered equal: - * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes - * @param expected the expected value - * @param actual the value to check against <code>expected</code> - * @param delta the maximum delta between <code>expected</code> and <code>actual</code> for which - * both numbers are still considered equal. - */ - static public void assertEquals(float expected, float actual, float delta) { - assertEquals(null, expected, actual, delta); - } - - /** * Asserts that an object isn't null. If it is an {@link AssertionError} is * thrown with the given message. * @param message the identifying message or <code>null</code> for the {@link AssertionError} @@ -411,4 +454,31 @@ return formatted + "expected:<" + expected + "> but was:<" + actual + ">"; } + /** + * 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. + * @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 + * @deprecated use assertArrayEquals + */ + @Deprecated + public static void assertEquals(String message, Object[] expecteds, Object[] actuals) { + assertArrayEquals(message, expecteds, actuals); + } + + /** + * 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 + * @deprecated use assertArrayEquals + */ + @Deprecated + public static void assertEquals(Object[] expecteds, Object[] actuals) { + assertArrayEquals(expecteds, actuals); + } + } |
From: David S. <ds...@us...> - 2007-01-24 16:33:08
|
Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11688/src/org/junit/tests Modified Files: AssertionTest.java AllTests.java Added Files: IgnoreClassTest.java Removed Files: CustomMethodRunnerTest.java MixInTest.java Log Message: Can @Ignore classes assertArrayEquals added --- NEW FILE: IgnoreClassTest.java --- package org.junit.tests; import static org.junit.Assert.*; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.JUnitCore; import org.junit.runner.Result; public class IgnoreClassTest { @Ignore public static class IgnoreMe { @Test public void iFail() { fail(); } @Test public void iFailToo() { fail(); } } @Test public void ignoreClass() { Result result= JUnitCore.runClasses(IgnoreMe.class); assertEquals(0, result.getFailureCount()); assertEquals(1, result.getIgnoreCount()); } } Index: AssertionTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AssertionTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AssertionTest.java 6 Dec 2006 01:22:48 -0000 1.3 +++ AssertionTest.java 24 Jan 2007 16:32:59 -0000 1.4 @@ -1,6 +1,7 @@ package org.junit.tests; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.fail; @@ -25,16 +26,16 @@ } @Test(expected= AssertionError.class) public void arraysNotEqual() { - assertEquals(new Object[] {new Object()}, new Object[] {new Object()}); + assertArrayEquals((new Object[] {new Object()}), (new Object[] {new Object()})); } @Test(expected= AssertionError.class) public void arraysNotEqualWithMessage() { - assertEquals("not equal", new Object[] {new Object()}, new Object[] {new Object()}); + assertArrayEquals("not equal", (new Object[] {new Object()}), (new Object[] {new Object()})); } @Test public void arraysExpectedNullMessage() { try { - assertEquals("not equal", null, new Object[] {new Object()}); + assertArrayEquals("not equal", null, (new Object[] {new Object()})); } catch (AssertionError exception) { assertEquals("not equal: expected array was null", exception.getMessage()); } @@ -42,7 +43,7 @@ @Test public void arraysActualNullMessage() { try { - assertEquals("not equal", new Object[] {new Object()}, null); + assertArrayEquals("not equal", (new Object[] {new Object()}), null); } catch (AssertionError exception) { assertEquals("not equal: actual array was null", exception.getMessage()); } @@ -50,19 +51,19 @@ @Test public void arraysDifferentLengthMessage() { try { - assertEquals("not equal", new Object[0] , new Object[1]); + assertArrayEquals("not equal", (new Object[0]), (new Object[1])); } catch (AssertionError exception) { assertEquals("not equal: array lengths differed, expected.length=0 actual.length=1", exception.getMessage()); } } @Test(expected=ArrayComparisonFailure.class) public void arraysElementsDiffer() { - assertEquals("not equal", new Object[] {"this is a very long string in the middle of an array"} , new Object[] {"this is another very long string in the middle of an array"}); + assertArrayEquals("not equal", (new Object[] {"this is a very long string in the middle of an array"}), (new Object[] {"this is another very long string in the middle of an array"})); } @Test public void arraysDifferAtElement0nullMessage() { try { - assertEquals(new Object[] { true }, new Object[] { false }); + assertArrayEquals((new Object[] { true }), (new Object[] { false })); } catch (AssertionError exception) { assertEquals("arrays first differed at element [0]; expected:<true> but was:<false>", exception .getMessage()); @@ -71,8 +72,8 @@ @Test public void arraysDifferAtElement1nullMessage() { try { - assertEquals(new Object[] { true, true }, new Object[] { true, - false }); + assertArrayEquals((new Object[] { true, true }), (new Object[] { true, + false })); } catch (AssertionError exception) { assertEquals("arrays first differed at element [1]; expected:<true> but was:<false>", exception .getMessage()); @@ -81,7 +82,7 @@ @Test public void arraysDifferAtElement0withMessage() { try { - assertEquals("message", new Object[] { true }, new Object[] { false }); + assertArrayEquals("message", (new Object[] { true }), (new Object[] { false })); } catch (AssertionError exception) { assertEquals("message: arrays first differed at element [0]; expected:<true> but was:<false>", exception .getMessage()); @@ -90,7 +91,7 @@ @Test public void arraysDifferAtElement1withMessage() { try { - assertEquals("message", new Object[] {true, true}, new Object[] {true, false}); + assertArrayEquals("message", (new Object[] {true, true}), (new Object[] {true, false})); fail(); } catch (AssertionError exception) { assertEquals("message: arrays first differed at element [1]; expected:<true> but was:<false>", exception.getMessage()); @@ -98,16 +99,43 @@ } @Test public void multiDimensionalArraysAreEqual() { - assertEquals(new Object[][]{{true, true}, {false, false}}, new Object[][]{{true, true}, {false, false}}); + assertArrayEquals((new Object[][]{{true, true}, {false, false}}), (new Object[][]{{true, true}, {false, false}})); + } + + @Test + public void multiDimensionalIntArraysAreEqual() { + int[][] int1= { { 1, 2, 3 }, { 4, 5, 6 } }; + int[][] int2= { { 1, 2, 3 }, { 4, 5, 6 } }; + assertArrayEquals(int1, int2); + } + + @Test + public void oneDimensionalPrimitiveArraysAreEqual() { + assertArrayEquals(new byte[] {1}, new byte[] {1}); + assertArrayEquals(new char[] {1}, new char[] {1}); + assertArrayEquals(new short[] {1}, new short[] {1}); + assertArrayEquals(new int[] {1}, new int[] {1}); + 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 public void intsEqualLongs() { + assertEquals(1, 1L); } @Test public void multiDimensionalArraysDeclaredAsOneDimensionalAreEqual() { - assertEquals(new Object[]{new Object[] {true, true}, new Object[] {false, false}}, new Object[]{new Object[] {true, true}, new Object[] {false, false}}); + assertArrayEquals((new Object[]{new Object[] {true, true}, new Object[] {false, false}}), (new Object[]{new Object[] {true, true}, new Object[] {false, false}})); } @Test public void multiDimensionalArraysAreNotEqual() { try { - assertEquals("message", new Object[][]{{true, true}, {false, false}}, new Object[][]{{true, true}, {true, false}}); + assertArrayEquals("message", (new Object[][]{{true, true}, {false, false}}), (new Object[][]{{true, true}, {true, false}})); fail(); } catch (AssertionError exception) { assertEquals("message: arrays first differed at element [1][0]; expected:<false> but was:<true>", exception.getMessage()); @@ -116,7 +144,7 @@ @Test public void multiDimensionalArraysAreNotEqualNoMessage() { try { - assertEquals(new Object[][]{{true, true}, {false, false}}, new Object[][]{{true, true}, {true, false}}); + assertArrayEquals((new Object[][]{{true, true}, {false, false}}), (new Object[][]{{true, true}, {true, false}})); fail(); } catch (AssertionError exception) { assertEquals("arrays first differed at element [1][0]; expected:<false> but was:<true>", exception.getMessage()); @@ -135,14 +163,14 @@ Object element= new Object(); Object[] objects1= new Object[] {element}; Object[] objects2= new Object[] {element}; - assertEquals(objects1, objects2); + assertArrayEquals(objects1, objects2); } @Test public void arraysEqualWithMessage() { Object element= new Object(); Object[] objects1= new Object[] {element}; Object[] objects2= new Object[] {element}; - assertEquals("equal", objects1, objects2); + assertArrayEquals("equal", objects1, objects2); } @Test public void equals() { Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AllTests.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AllTests.java 27 Dec 2006 22:27:22 -0000 1.5 +++ AllTests.java 24 Jan 2007 16:32:59 -0000 1.6 @@ -8,10 +8,9 @@ @RunWith(Suite.class) @SuiteClasses({ - CustomMethodRunnerTest.class, ListenerTest.class, FailedConstructionTest.class, - MixInTest.class, + // TODO: What did CVS do with this? CustomRunnerTest.class, TestDescriptionTest.class, SuiteDescriptionTest.class, AllTestsTest.class, @@ -41,7 +40,8 @@ JUnitCoreTest.class, InaccessibleBaseClassTest.class, SuiteMethodTest.class, - TestClassMethodsRunnerTest.class + TestClassMethodsRunnerTest.class, + IgnoreClassTest.class, }) public class AllTests { // public static class Compatibility { --- CustomMethodRunnerTest.java DELETED --- --- MixInTest.java DELETED --- |
From: David S. <ds...@us...> - 2007-01-24 16:33:07
|
Update of /cvsroot/junit/junit/src/org/junit/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11688/src/org/junit/runners Removed Files: Replaces.java RunMethodWith.java MethodRunner.java Log Message: Can @Ignore classes assertArrayEquals added --- Replaces.java DELETED --- --- RunMethodWith.java DELETED --- --- MethodRunner.java DELETED --- |
Update of /cvsroot/junit/junit/src/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11688/src/org/junit/internal/runners Modified Files: TestClassMethodsRunner.java TestIntrospector.java MethodValidator.java BeforeAndAfterRunner.java Removed Files: MixIn.java TestMethod.java Log Message: Can @Ignore classes assertArrayEquals added Index: TestClassMethodsRunner.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/TestClassMethodsRunner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TestClassMethodsRunner.java 27 Dec 2006 22:27:22 -0000 1.2 +++ TestClassMethodsRunner.java 24 Jan 2007 16:32:59 -0000 1.3 @@ -17,33 +17,28 @@ import org.junit.runner.manipulation.Sorter; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunNotifier; -import org.junit.runners.MethodRunner; -public class TestClassMethodsRunner extends Runner implements Filterable, - Sortable { +public class TestClassMethodsRunner extends Runner implements Filterable, Sortable { private final List<Method> fTestMethods; - private final Class<?> fTestClass; - // This assumes that some containing runner will perform validation of the - // test methods + // This assumes that some containing runner will perform validation of the test methods public TestClassMethodsRunner(Class<?> klass) { fTestClass= klass; - fTestMethods= new TestIntrospector(getTestClass()) - .getTestMethods(Test.class); + fTestMethods= new TestIntrospector(getTestClass()).getTestMethods(Test.class); } - + @Override public void run(RunNotifier notifier) { if (fTestMethods.isEmpty()) - testAborted(notifier, getDescription(), new Exception( - "No runnable methods")); + testAborted(notifier, getDescription(), new Exception("No runnable methods")); for (Method method : fTestMethods) invokeTestMethod(method, notifier); } - private void testAborted(RunNotifier notifier, Description description, - Throwable cause) { + private void testAborted(RunNotifier notifier, Description description, Throwable cause) { + // TODO: duped! + // TODO: envious notifier.fireTestStarted(description); notifier.fireTestFailure(new Failure(description, cause)); notifier.fireTestFinished(description); @@ -54,14 +49,14 @@ Description spec= Description.createSuiteDescription(getName()); List<Method> testMethods= fTestMethods; for (Method method : testMethods) - spec.addChild(methodDescription(method)); + spec.addChild(methodDescription(method)); return spec; } protected String getName() { return getTestClass().getName(); } - + protected Object createTest() throws Exception { return getTestClass().getConstructor().newInstance(); } @@ -71,38 +66,17 @@ try { test= createTest(); } catch (InvocationTargetException e) { - testAborted(notifier, method, e.getCause()); - return; - } catch (Throwable e) { - testAborted(notifier, method, e); - return; - } - - TestMethod testMethod= new TestMethod(test, method, - methodDescription(method)); - try { - MethodRunner runner= testMethod.findCustomRunner(this); - if (runner == null) - createMethodRunner(test, method, notifier).run(); - else { - runner.run(testMethod, notifier); - } + testAborted(notifier, methodDescription(method), e.getCause()); + return; } catch (Exception e) { - Throwable exception= new RuntimeException( - "Exception creating custom method runner", e); - testAborted(notifier, method, exception); + testAborted(notifier, methodDescription(method), e); + return; } + createMethodRunner(test, method, notifier).run(); } - private void testAborted(RunNotifier notifier, Method method, - Throwable cause) { - testAborted(notifier, methodDescription(method), cause); - } - - protected TestMethodRunner createMethodRunner(Object test, Method method, - RunNotifier notifier) { - return new TestMethodRunner(test, method, notifier, - methodDescription(method)); + protected TestMethodRunner createMethodRunner(Object test, Method method, RunNotifier notifier) { + return new TestMethodRunner(test, method, notifier, methodDescription(method)); } protected String testName(Method method) { @@ -110,8 +84,7 @@ } protected Description methodDescription(Method method) { - return Description.createTestDescription(getTestClass(), - testName(method)); + return Description.createTestDescription(getTestClass(), testName(method)); } public void filter(Filter filter) throws NoTestsRemainException { @@ -127,8 +100,7 @@ public void sort(final Sorter sorter) { Collections.sort(fTestMethods, new Comparator<Method>() { public int compare(Method o1, Method o2) { - return sorter.compare(methodDescription(o1), - methodDescription(o2)); + return sorter.compare(methodDescription(o1), methodDescription(o2)); } }); } Index: TestIntrospector.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/TestIntrospector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TestIntrospector.java 27 Dec 2006 22:27:22 -0000 1.3 +++ TestIntrospector.java 24 Jan 2007 16:32:59 -0000 1.4 @@ -11,121 +11,76 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.Test.None; -import org.junit.runners.Replaces; - -public class TestIntrospector { - private static class MethodCollector { - private List<Method> methods= new ArrayList<Method>(); - - private Class<? extends Annotation> annotationClass; - - public MethodCollector(Class<? extends Annotation> annotationClass) { - this.annotationClass= annotationClass; - } - public MethodCollector addMethods(Class<?> testClass) { - for (Method eachMethod : testClass.getDeclaredMethods()) { - if (hasAnnotation(eachMethod) && !isShadowed(eachMethod)) - methods.add(eachMethod); - } - addSuperclasses(testClass); - addMixins(testClass); - return this; - } - - private boolean hasAnnotation(Method method) { - return method.getAnnotation(annotationClass) != null - || hasReplacementAnnotation(method); - } +public class TestIntrospector { + private final Class< ?> fTestClass; + + public TestIntrospector(Class<?> testClass) { + fTestClass= testClass; + } - private boolean hasReplacementAnnotation(Method method) { - Annotation[] annotations= method.getAnnotations(); - for (Annotation annotation : annotations) { - Replaces replaces= annotation.annotationType().getAnnotation( - Replaces.class); - if (replaces != null - && replaces.value().equals(annotationClass)) - return true; + public List<Method> getTestMethods(Class<? extends Annotation> annotationClass) { + List<Method> results= new ArrayList<Method>(); + for (Class<?> eachClass : getSuperClasses(fTestClass)) { + Method[] methods= eachClass.getDeclaredMethods(); + for (Method eachMethod : methods) { + Annotation annotation= eachMethod.getAnnotation(annotationClass); + if (annotation != null && ! isShadowed(eachMethod, results)) + results.add(eachMethod); } - return false; } + if (runsTopToBottom(annotationClass)) + Collections.reverse(results); + return results; + } - private void addMixins(Class<?> testClass) { - MixIn mixins= testClass.getAnnotation(MixIn.class); - if (mixins != null) - for (Class<?> type : mixins.value()) - addMethods(type); - } + public boolean isIgnored(Method eachMethod) { + return eachMethod.getAnnotation(Ignore.class) != null; + } - private void addSuperclasses(Class<?> testClass) { - Class<?> superclass= testClass.getSuperclass(); - if (superclass != null) - addMethods(testClass.getSuperclass()); + private boolean runsTopToBottom(Class< ? extends Annotation> annotation) { + return annotation.equals(Before.class) || annotation.equals(BeforeClass.class); + } + + private boolean isShadowed(Method method, List<Method> results) { + for (Method each : results) { + if (isShadowed(method, each)) + return true; } + return false; + } - private boolean isShadowed(Method method) { - for (Method each : methods) { - if (isShadowed(method, each)) - return true; - } + private boolean isShadowed(Method current, Method previous) { + if (! previous.getName().equals(current.getName())) return false; - } - - private boolean isShadowed(Method current, Method previous) { - if (!previous.getName().equals(current.getName())) - return false; - if (previous.getParameterTypes().length != current - .getParameterTypes().length) + if (previous.getParameterTypes().length != current.getParameterTypes().length) + return false; + for (int i= 0; i < previous.getParameterTypes().length; i++) { + if (! previous.getParameterTypes()[i].equals(current.getParameterTypes()[i])) return false; - for (int i= 0; i < previous.getParameterTypes().length; i++) { - if (!previous.getParameterTypes()[i].equals(current - .getParameterTypes()[i])) - return false; - } - return true; - } - - public List<Method> getMethods() { - return methods; } + return true; } - private final Class<?> fTestClass; - - public TestIntrospector(Class<?> testClass) { - fTestClass= testClass; - } - - public List<Method> getTestMethods( - Class<? extends Annotation> annotationClass) { - List<Method> results= new MethodCollector(annotationClass).addMethods( - fTestClass).getMethods(); - if (runsTopToBottom(annotationClass)) - Collections.reverse(results); + private List<Class<?>> getSuperClasses(Class< ?> testClass) { + ArrayList<Class<?>> results= new ArrayList<Class<?>>(); + Class<?> current= testClass; + while (current != null) { + results.add(current); + current= current.getSuperclass(); + } return results; } - public boolean isIgnored(Method method) { - return method.getAnnotation(Ignore.class) != null; - } - - private boolean runsTopToBottom(Class<? extends Annotation> annotation) { - return annotation.equals(Before.class) - || annotation.equals(BeforeClass.class); - } - long getTimeout(Method method) { Test annotation= method.getAnnotation(Test.class); - if (annotation == null) - return 0; - return annotation.timeout(); + long timeout= annotation.timeout(); + return timeout; } Class<? extends Throwable> expectedException(Method method) { Test annotation= method.getAnnotation(Test.class); - if (annotation == null) - return null; if (annotation.expected() == None.class) return null; else @@ -133,3 +88,4 @@ } } + Index: MethodValidator.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/MethodValidator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MethodValidator.java 27 Dec 2006 17:45:54 -0000 1.2 +++ MethodValidator.java 24 Jan 2007 16:32:59 -0000 1.3 @@ -57,15 +57,14 @@ } private void validateTestMethods(Class<? extends Annotation> annotation, - boolean shouldBeStatic) { + boolean isStatic) { List<Method> methods= fIntrospector.getTestMethods(annotation); for (Method each : methods) { - if (shouldBeStatic && !isStatic(each)) - fErrors.add(new Exception("Method " + each.getName() + "() " - + "should be static")); - if (!shouldBeStatic && runsAsStatic(each)) + if (Modifier.isStatic(each.getModifiers()) != isStatic) { + String state= isStatic ? "should" : "should not"; fErrors.add(new Exception("Method " + each.getName() + "() " - + "should not be static")); + + state + " be static")); + } if (!Modifier.isPublic(each.getDeclaringClass().getModifiers())) fErrors.add(new Exception("Class " + each.getDeclaringClass().getName() + " should be public")); @@ -75,24 +74,9 @@ if (each.getReturnType() != Void.TYPE) fErrors.add(new Exception("Method " + each.getName() + " should be void")); - if (effectiveParameterCount(each, shouldBeStatic) != 0) + if (each.getParameterTypes().length != 0) fErrors.add(new Exception("Method " + each.getName() + " should have no parameters")); } } - - private int effectiveParameterCount(Method method, boolean shouldBeStatic) { - int rawLength= method.getParameterTypes().length; - if (!shouldBeStatic && isStatic(method) && rawLength > 0) - return rawLength - 1; - return rawLength; - } - - private boolean runsAsStatic(Method method) { - return isStatic(method) && !(method.getParameterTypes().length == 1); - } - - private boolean isStatic(Method method) { - return Modifier.isStatic(method.getModifiers()); - } } Index: BeforeAndAfterRunner.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/BeforeAndAfterRunner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- BeforeAndAfterRunner.java 27 Dec 2006 17:45:54 -0000 1.2 +++ BeforeAndAfterRunner.java 24 Jan 2007 16:32:59 -0000 1.3 @@ -3,7 +3,6 @@ import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.util.List; public abstract class BeforeAndAfterRunner { @@ -72,12 +71,6 @@ } private void invokeMethod(Method method) throws Exception { - if (Modifier.isStatic(method.getModifiers())) - if (method.getParameterTypes().length > 0) - method.invoke(null, fTest); - else - method.invoke(null); - else - method.invoke(fTest); + method.invoke(fTest); } } --- MixIn.java DELETED --- --- TestMethod.java DELETED --- |
From: David S. <ds...@us...> - 2007-01-24 16:33:05
|
Update of /cvsroot/junit/junit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11688 Modified Files: to-do.txt Log Message: Can @Ignore classes assertArrayEquals added Index: to-do.txt =================================================================== RCS file: /cvsroot/junit/junit/to-do.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- to-do.txt 25 Aug 2006 14:43:03 -0000 1.4 +++ to-do.txt 24 Jan 2007 16:32:59 -0000 1.5 @@ -1,3 +1,6 @@ +* What happened to CustomRunnerTest? +* assertArrayEquals(double[], double[], double) and assertArrayEquals(float[], float[], float) + * update documentation * new cook's tour * update Test Infected |
From: David S. <ds...@us...> - 2007-01-24 16:33:04
|
Update of /cvsroot/junit/junit/src/org/junit/internal/requests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11688/src/org/junit/internal/requests Modified Files: ClassRequest.java Added Files: IgnoredClassRunner.java Log Message: Can @Ignore classes assertArrayEquals added --- NEW FILE: IgnoredClassRunner.java --- /** * */ package org.junit.internal.requests; import org.junit.runner.Description; import org.junit.runner.Runner; import org.junit.runner.notification.RunNotifier; public class IgnoredClassRunner extends Runner { private final Class<?> fTestClass; public IgnoredClassRunner(Class<?> testClass) { fTestClass= testClass; } @Override public void run(RunNotifier notifier) { notifier.fireTestIgnored(getDescription()); } @Override public Description getDescription() { return Description.createSuiteDescription(fTestClass); } } Index: ClassRequest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/requests/ClassRequest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ClassRequest.java 13 Dec 2006 02:10:51 -0000 1.2 +++ ClassRequest.java 24 Jan 2007 16:32:59 -0000 1.3 @@ -2,6 +2,7 @@ import java.lang.reflect.Constructor; +import org.junit.Ignore; import org.junit.internal.runners.OldTestClassRunner; import org.junit.internal.runners.TestClassRunner; import org.junit.runner.Request; @@ -35,7 +36,9 @@ } } - Class<? extends Runner> getRunnerClass(Class<?> testClass) { + Class<? extends Runner> getRunnerClass(final Class<?> testClass) { + if (testClass.getAnnotation(Ignore.class) != null) + return new IgnoredClassRunner(testClass).getClass(); RunWith annotation= testClass.getAnnotation(RunWith.class); if (annotation != null) { return annotation.value(); |
From: David S. <sa...@mi...> - 2007-01-24 02:43:56
|
All, I accidentally took this conversation off-line, but I think the final answer is valuable for posterity: If you're using JUnit 4, this should work. There's a way to do it in JUnit 3, as well, but it's more complicated. Good luck, David Saff import junit.framework.Test; import junit.framework.TestSuite; import org.junit.runner.JUnitCore; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunListener; public class RunWithLogging { public static void main(String[] args) { JUnitCore core = new JUnitCore(); core.addListener(new RunListener() { @Override public void testFailure(Failure failure) throws Exception { logSomehow(failure); } }); core.run(suite()); } private static Test suite() { return new TestSuite(Sample.class); } private static void logSomehow(Failure failure) { // TODO: Fill in log4j stuff here } } On 1/12/07, pari krishnan <spa...@ya...> wrote: > Hi, > > I need help..I want to divert assert message to my own log file with log4j. > I have referred some link that it is not possible to divert assert message > to log file with log4j as of version Junit 3.8.2. > Just want to know whether it will support with new version Junit (above 4 > version)? > Plz help... > Ur mail will be helpful for me a lot > > Thanks & regards > pari > > hat assertions are not logged via Log4J > > > ________________________________ > Here's a new way to find what you're looking for - Yahoo! Answers > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > Junit-devel mailing list > Jun...@li... > https://lists.sourceforge.net/lists/listinfo/junit-devel > > > |
From: pari k. <spa...@ya...> - 2007-01-12 06:26:32
|
Hi, I need help..I want to divert assert message to my own log file with log4j. I have referred some link that it is not possible to divert assert message to log file with log4j as of version Junit 3.8.2. Just want to know whether it will support with new version Junit (above 4 version)? Plz help... Ur mail will be helpful for me a lot Thanks & regards pari hat assertions are not logged via Log4J --------------------------------- Heres a new way to find what you're looking for - Yahoo! Answers |
From: Build A. <vim...@vi...> - 2007-01-09 22:17:58
|
BUILD result ------------------------------------------------------------ BUILD for webwork (#8) on localhost TIMED OUT: Timed out after 30 minutes and was stopped. Build status: http://parabuild.viewtier.com:8080/parabuild/index.htm?detview=true&buildid=707 Suspect changes ------------------------------------------------------------ Change(s) by tmjee : - - added javadoc Issue number: Obtained from: Submitted by: ; Time: 10:08 AM 01/09/2007; Change list: 1804 - - removed unecessary import statement - added cookie interce; Time: 09:45 AM 01/09/2007; Change list: 1803 - - implementation of a cookie interceptor Issue number: WW-; Time: 09:04 AM 01/09/2007; Change list: 1802 Change(s) details: http://parabuild.viewtier.com:8080/parabuild/build/changes.htm?buildrunid=1103 BUILD logs ------------------------------------------------------------ Main BUILD log: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=1553 Error lines: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=1554 Log lines around error ------------------------------------------------------------ [ivy-retrieve] found [ cewolf | cewolf | 1.0 ] in ivyrep [ivy-retrieve] found [ hibernate | hibernate | 3.0.5 ] in contegix [ivy-retrieve] found [ cglib | cglib | 2.1 ] in ivyrep [ivy-retrieve] found [ apache | commons-collections | 2.1.1 ] in ivyrep [ivy-retrieve] found [ dom4j | dom4j | 1.6 ] in ivyrep [ivy-retrieve] found [ ehcache | ehcache | 1.1 ] in ivyrep [ivy-retrieve] found [ objectweb | asm | 1.5.3 ] in contegix [ivy-retrieve] found [ antlr | antlr | 2.7.5H3 ] in contegix-maven [ivy-retrieve] found [ org.apache.struts.tiles | tiles-core | 0.2-SNAPSHOT ] in opensymphony [ivy-retrieve] :: resolution report :: [ivy-retrieve] :: evicted modules: [ivy-retrieve] [ ognl | ognl | 2.6.7 ] by [[ ognl | ognl | 2.6.9 ]] in [default] --------------------------------------------------------------------- | | modules || artifacts | | conf | number| search|dwnlded|evicted|| number|dwnlded| --------------------------------------------------------------------- | build | 15 | 0 | 0 | 0 || 15 | 0 | | default | 8 | 4 | 0 | 1 || 7 | 0 | | source | 1 | 1 | 0 | 0 || 1 | 0 | | ajax | 1 | 1 | 0 | 0 || 1 | 0 | | freemarker | 0 | 0 | 0 | 0 || 0 | 0 | | velocity | 4 | 0 | 0 | 0 || 4 | 0 | | fileupload | 1 | 0 | 0 | 0 || 1 | 0 | | fileupload-cos | 1 | 0 | 0 | 0 || 1 | 0 | | fileupload-pell | 1 | 0 | 0 | 0 || 1 | 0 | | sitemesh | 1 | 0 | 0 | 0 || 1 | 0 | | quickstart | 13 | 3 | 0 | 0 || 13 | 0 | | jasperreports | 6 | 0 | 0 | 0 || 6 | 0 | | jfree | 2 | 0 | 0 | 0 || 2 | 0 | | xslt | 2 | 1 | 0 | 0 || 2 | 0 | | portlet | 1 | 0 | 0 | 0 || 1 | 0 | | spring | 5 | 1 | 0 | 0 || 9 | 0 | | pico | 4 | 0 | 0 | 0 || 4 | 0 | | plexus | 3 | 2 | 0 | 0 || 3 | 0 | | tiger | 1 | 1 | 0 | 0 || 1 | 0 | | cewolf | 1 | 0 | 0 | 0 || 1 | 0 | | hibernate | 8 | 0 | 0 | 0 || 8 | 0 | | tiles | 3 | 1 | 0 | 0 || 3 | 0 | --------------------------------------------------------------------- [ivy-retrieve] :: retrieving :: [ opensymphony | webwork ] [ivy-retrieve] confs: [build, default, source, ajax, freemarker, velocity, fileupload, fileupload-cos, fileupload-pell, sitemesh, quickstart, jasperreports, jfree, xslt, portlet, spring, pico, plexus, tiger, cewolf, hibernate, tiles] [ivy-retrieve] conflict on /opt/parabuild/etc/build/b707co/a/u/t/o/webwork/lib/velocity/commons-collections.jar in [velocity]: 2.1.1 won [ivy-retrieve] 0 artifacts copied, 84 already retrieved precompile: compile: [javac] Compiling 2 source files to /opt/parabuild/etc/build/b707co/a/u/t/o/webwork/build/java [copy] Copying 1 file to /opt/parabuild/etc/build/b707co/a/u/t/o/webwork/build/java jar: [jar] Building jar: /opt/parabuild/etc/build/b707co/a/u/t/o/webwork/build/webwork-2.2.5.jar /opt/parabuild/etc/build/b707tm/.cmd47546.sh: line 22: 24134 Killed sh /opt/parabuild/etc/build/b707sc/s1173.sh Timings ------------------------------------------------------------ BUILD took 30 minutes 57 seconds |
From: Build A. <vim...@vi...> - 2007-01-07 13:13:52
|
BUILD result ------------------------------------------------------------ BUILD for webwork (#3) on localhost TIMED OUT: Timed out after 30 minutes and was stopped. Build status: http://parabuild.viewtier.com:8080/parabuild/index.htm?detview=true&buildid=707 Suspect changes ------------------------------------------------------------ Change(s) by tmjee : - - removed uneeded import statement Issue number: Obtained f; Time: 04:20 AM 01/07/2007; Change list: 1566 Change(s) details: http://parabuild.viewtier.com:8080/parabuild/build/changes.htm?buildrunid=934 BUILD logs ------------------------------------------------------------ Main BUILD log: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=1324 Error lines: http://parabuild.viewtier.com:8080/parabuild/build/log.htm?logid=1325 Log lines around error ------------------------------------------------------------ [ivy-retrieve] found [ classworlds | classworlds | 1.1 ] in ivyrep [ivy-retrieve] found [ opensymphony | xwork-tiger | 1.2.1 ] in opensymphony [ivy-retrieve] found [ cewolf | cewolf | 1.0 ] in ivyrep [ivy-retrieve] found [ hibernate | hibernate | 3.0.5 ] in contegix [ivy-retrieve] found [ cglib | cglib | 2.1 ] in ivyrep [ivy-retrieve] found [ apache | commons-collections | 2.1.1 ] in ivyrep [ivy-retrieve] found [ dom4j | dom4j | 1.6 ] in ivyrep [ivy-retrieve] found [ ehcache | ehcache | 1.1 ] in ivyrep [ivy-retrieve] found [ objectweb | asm | 1.5.3 ] in contegix [ivy-retrieve] found [ antlr | antlr | 2.7.5H3 ] in contegix-maven [ivy-retrieve] found [ org.apache.struts.tiles | tiles-core | 0.2-SNAPSHOT ] in opensymphony [ivy-retrieve] :: resolution report :: [ivy-retrieve] :: evicted modules: [ivy-retrieve] [ ognl | ognl | 2.6.7 ] by [[ ognl | ognl | 2.6.9 ]] in [default] --------------------------------------------------------------------- | | modules || artifacts | | conf | number| search|dwnlded|evicted|| number|dwnlded| --------------------------------------------------------------------- | build | 15 | 0 | 0 | 0 || 15 | 0 | | default | 8 | 4 | 0 | 1 || 7 | 0 | | source | 1 | 1 | 0 | 0 || 1 | 0 | | ajax | 1 | 1 | 0 | 0 || 1 | 0 | | freemarker | 0 | 0 | 0 | 0 || 0 | 0 | | velocity | 4 | 0 | 0 | 0 || 4 | 0 | | fileupload | 1 | 0 | 0 | 0 || 1 | 0 | | fileupload-cos | 1 | 0 | 0 | 0 || 1 | 0 | | fileupload-pell | 1 | 0 | 0 | 0 || 1 | 0 | | sitemesh | 1 | 0 | 0 | 0 || 1 | 0 | | quickstart | 13 | 3 | 0 | 0 || 13 | 0 | | jasperreports | 6 | 0 | 0 | 0 || 6 | 0 | | jfree | 2 | 0 | 0 | 0 || 2 | 0 | | xslt | 2 | 1 | 0 | 0 || 2 | 0 | | portlet | 1 | 0 | 0 | 0 || 1 | 0 | | spring | 5 | 1 | 0 | 0 || 9 | 0 | | pico | 4 | 0 | 0 | 0 || 4 | 0 | | plexus | 3 | 2 | 0 | 0 || 3 | 0 | | tiger | 1 | 1 | 0 | 0 || 1 | 0 | | cewolf | 1 | 0 | 0 | 0 || 1 | 0 | | hibernate | 8 | 0 | 0 | 0 || 8 | 0 | | tiles | 3 | 1 | 0 | 0 || 3 | 0 | --------------------------------------------------------------------- [ivy-retrieve] :: retrieving :: [ opensymphony | webwork ] [ivy-retrieve] confs: [build, default, source, ajax, freemarker, velocity, fileupload, fileupload-cos, fileupload-pell, sitemesh, quickstart, jasperreports, jfree, xslt, portlet, spring, pico, plexus, tiger, cewolf, hibernate, tiles] [ivy-retrieve] conflict on /opt/parabuild/etc/build/b707co/a/u/t/o/webwork/lib/velocity/commons-collections.jar in [velocity]: 2.1.1 won [ivy-retrieve] 0 artifacts copied, 84 already retrieved precompile: compile: [javac] Compiling 1 source file to /opt/parabuild/etc/build/b707co/a/u/t/o/webwork/build/java jar: [jar] Building jar: /opt/parabuild/etc/build/b707co/a/u/t/o/webwork/build/webwork-2.2.5.jar Timings ------------------------------------------------------------ BUILD took 30 minutes 03 seconds |
From: David S. <ds...@us...> - 2006-12-27 22:27:25
|
Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23274/src/org/junit/tests Modified Files: AllTests.java Added Files: CustomMethodRunnerTest.java Log Message: Another potential enhancement. RunMethodWith allows individual test methods to be run with different runners. --- NEW FILE: CustomMethodRunnerTest.java --- package org.junit.tests; import static org.junit.Assert.*; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import org.junit.Assert; import org.junit.Test; import org.junit.internal.runners.TestIntrospector; import org.junit.internal.runners.TestMethod; import org.junit.internal.runners.TestMethodRunner; import org.junit.runner.Description; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; import org.junit.runners.MethodRunner; import org.junit.runners.Replaces; import org.junit.runners.RunMethodWith; public class CustomMethodRunnerTest { @RunMethodWith(CustomMethodRunner.class) @Replaces(Test.class) @Retention(RetentionPolicy.RUNTIME) public @interface MyIgnore { } public static class CustomMethodRunner implements MethodRunner { public void run(TestMethod method, RunNotifier notifier) { notifier.fireTestStarted(method.getDescription()); notifier.fireTestIgnored(method.getDescription()); notifier.fireTestFinished(method.getDescription()); } } public static class UsesCustomMethodRunner { @MyIgnore public void thisIsIgnored() { Assert.fail(); } } @Test public void countCustomTests() { assertEquals(1, new TestIntrospector(UsesCustomMethodRunner.class) .getTestMethods(Test.class).size()); } @Test public void customMethodRunner() { Result result= JUnitCore.runClasses(UsesCustomMethodRunner.class); assertEquals(1, result.getIgnoreCount()); assertEquals(0, result.getFailureCount()); } public static class EvilCustomMethodRunner implements MethodRunner { public EvilCustomMethodRunner() { throw new RuntimeException(); } public void run(TestMethod method, RunNotifier notifier) { // do nothing } } public static class UsesEvilCustomMethodRunner { @RunMethodWith(EvilCustomMethodRunner.class) @Test public void thisShouldNeverRun() { } } @Test public void problemInstantiatingCustomRunner() { Result result= JUnitCore.runClasses(UsesEvilCustomMethodRunner.class); Failure failure= result.getFailures().get(0); assertTrue(failure.getMessage().contains( "Exception creating custom method runner")); } public static class PointlessCustomMethodRunner implements MethodRunner { public void run(TestMethod method, RunNotifier notifier) { new TestMethodRunner(method.getTest(), method.getJavaMethod(), notifier, method.getDescription()).run(); } } public static class UsesPointlessCustomMethodRunner { @RunMethodWith(PointlessCustomMethodRunner.class) @Test public void thisShouldRun() { fail("Something happened!"); } } @Test public void allInformationIsPassedToMethodRunner() { Result result= JUnitCore .runClasses(UsesPointlessCustomMethodRunner.class); Failure failure= result.getFailures().get(0); assertEquals("Something happened!", failure.getMessage()); } @Test public void allInformationIsPassedToNotifier() { RunListener listener= new RunListener() { @Override public void testStarted(Description description) throws Exception { assertEquals( Description.createTestDescription( UsesPointlessCustomMethodRunner.class, "thisShouldRun"), description); } }; JUnitCore core= new JUnitCore(); core.addListener(listener); core.run(UsesPointlessCustomMethodRunner.class); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AllTests.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AllTests.java 27 Dec 2006 17:45:54 -0000 1.4 +++ AllTests.java 27 Dec 2006 22:27:22 -0000 1.5 @@ -8,6 +8,7 @@ @RunWith(Suite.class) @SuiteClasses({ + CustomMethodRunnerTest.class, ListenerTest.class, FailedConstructionTest.class, MixInTest.class, |
From: David S. <ds...@us...> - 2006-12-27 22:27:25
|
Update of /cvsroot/junit/junit/src/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23274/src/org/junit/internal/runners Modified Files: TestClassMethodsRunner.java TestIntrospector.java Added Files: TestMethod.java Log Message: Another potential enhancement. RunMethodWith allows individual test methods to be run with different runners. --- NEW FILE: TestMethod.java --- package org.junit.internal.runners; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import org.junit.runner.Description; import org.junit.runners.MethodRunner; import org.junit.runners.RunMethodWith; public class TestMethod { private final Object fTest; private final Method fJavaMethod; private final Description fDescription; public TestMethod(Object test, Method javaMethod, Description description) { fTest= test; fJavaMethod= javaMethod; fDescription= description; } public Description getDescription() { return fDescription; } public Object getTest() { return fTest; } public Method getJavaMethod() { return fJavaMethod; } MethodRunner findCustomRunner(TestClassMethodsRunner testClassMethodsRunner) throws Exception { Method method= getJavaMethod(); AnnotatedElement method2= method; MethodRunner methodRunner= createCustomRunner(method2); if (methodRunner != null) return methodRunner; for (Annotation a : method2.getAnnotations()) { AnnotatedElement annotationType= a.annotationType(); MethodRunner arunner= createCustomRunner(annotationType); if (arunner != null) return arunner; } return null; } private MethodRunner createCustomRunner(AnnotatedElement annotationType) throws Exception { RunMethodWith runMethodWith= annotationType .getAnnotation(RunMethodWith.class); if (runMethodWith != null) return runMethodWith.value().newInstance(); return null; } } Index: TestClassMethodsRunner.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/TestClassMethodsRunner.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TestClassMethodsRunner.java 21 Nov 2006 18:53:34 -0000 1.1 +++ TestClassMethodsRunner.java 27 Dec 2006 22:27:22 -0000 1.2 @@ -17,28 +17,33 @@ import org.junit.runner.manipulation.Sorter; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunNotifier; +import org.junit.runners.MethodRunner; -public class TestClassMethodsRunner extends Runner implements Filterable, Sortable { +public class TestClassMethodsRunner extends Runner implements Filterable, + Sortable { private final List<Method> fTestMethods; + private final Class<?> fTestClass; - // This assumes that some containing runner will perform validation of the test methods + // This assumes that some containing runner will perform validation of the + // test methods public TestClassMethodsRunner(Class<?> klass) { fTestClass= klass; - fTestMethods= new TestIntrospector(getTestClass()).getTestMethods(Test.class); + fTestMethods= new TestIntrospector(getTestClass()) + .getTestMethods(Test.class); } - + @Override public void run(RunNotifier notifier) { if (fTestMethods.isEmpty()) - testAborted(notifier, getDescription(), new Exception("No runnable methods")); + testAborted(notifier, getDescription(), new Exception( + "No runnable methods")); for (Method method : fTestMethods) invokeTestMethod(method, notifier); } - private void testAborted(RunNotifier notifier, Description description, Throwable cause) { - // TODO: duped! - // TODO: envious + private void testAborted(RunNotifier notifier, Description description, + Throwable cause) { notifier.fireTestStarted(description); notifier.fireTestFailure(new Failure(description, cause)); notifier.fireTestFinished(description); @@ -49,14 +54,14 @@ Description spec= Description.createSuiteDescription(getName()); List<Method> testMethods= fTestMethods; for (Method method : testMethods) - spec.addChild(methodDescription(method)); + spec.addChild(methodDescription(method)); return spec; } protected String getName() { return getTestClass().getName(); } - + protected Object createTest() throws Exception { return getTestClass().getConstructor().newInstance(); } @@ -66,17 +71,38 @@ try { test= createTest(); } catch (InvocationTargetException e) { - testAborted(notifier, methodDescription(method), e.getCause()); - return; - } catch (Exception e) { - testAborted(notifier, methodDescription(method), e); + testAborted(notifier, method, e.getCause()); + return; + } catch (Throwable e) { + testAborted(notifier, method, e); return; } - createMethodRunner(test, method, notifier).run(); + + TestMethod testMethod= new TestMethod(test, method, + methodDescription(method)); + try { + MethodRunner runner= testMethod.findCustomRunner(this); + if (runner == null) + createMethodRunner(test, method, notifier).run(); + else { + runner.run(testMethod, notifier); + } + } catch (Exception e) { + Throwable exception= new RuntimeException( + "Exception creating custom method runner", e); + testAborted(notifier, method, exception); + } } - protected TestMethodRunner createMethodRunner(Object test, Method method, RunNotifier notifier) { - return new TestMethodRunner(test, method, notifier, methodDescription(method)); + private void testAborted(RunNotifier notifier, Method method, + Throwable cause) { + testAborted(notifier, methodDescription(method), cause); + } + + protected TestMethodRunner createMethodRunner(Object test, Method method, + RunNotifier notifier) { + return new TestMethodRunner(test, method, notifier, + methodDescription(method)); } protected String testName(Method method) { @@ -84,7 +110,8 @@ } protected Description methodDescription(Method method) { - return Description.createTestDescription(getTestClass(), testName(method)); + return Description.createTestDescription(getTestClass(), + testName(method)); } public void filter(Filter filter) throws NoTestsRemainException { @@ -100,7 +127,8 @@ public void sort(final Sorter sorter) { Collections.sort(fTestMethods, new Comparator<Method>() { public int compare(Method o1, Method o2) { - return sorter.compare(methodDescription(o1), methodDescription(o2)); + return sorter.compare(methodDescription(o1), + methodDescription(o2)); } }); } Index: TestIntrospector.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/TestIntrospector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TestIntrospector.java 27 Dec 2006 17:45:54 -0000 1.2 +++ TestIntrospector.java 27 Dec 2006 22:27:22 -0000 1.3 @@ -11,6 +11,7 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.Test.None; +import org.junit.runners.Replaces; public class TestIntrospector { private static class MethodCollector { @@ -24,21 +25,36 @@ public MethodCollector addMethods(Class<?> testClass) { for (Method eachMethod : testClass.getDeclaredMethods()) { - Annotation annotation= eachMethod - .getAnnotation(annotationClass); - if (annotation != null && !isShadowed(eachMethod)) + if (hasAnnotation(eachMethod) && !isShadowed(eachMethod)) methods.add(eachMethod); } - - addSuperclasses(testClass); + + addSuperclasses(testClass); addMixins(testClass); return this; } + private boolean hasAnnotation(Method method) { + return method.getAnnotation(annotationClass) != null + || hasReplacementAnnotation(method); + } + + private boolean hasReplacementAnnotation(Method method) { + Annotation[] annotations= method.getAnnotations(); + for (Annotation annotation : annotations) { + Replaces replaces= annotation.annotationType().getAnnotation( + Replaces.class); + if (replaces != null + && replaces.value().equals(annotationClass)) + return true; + } + return false; + } + private void addMixins(Class<?> testClass) { MixIn mixins= testClass.getAnnotation(MixIn.class); if (mixins != null) - for (Class<?> type : mixins.value()) + for (Class<?> type : mixins.value()) addMethods(type); } @@ -90,8 +106,8 @@ return results; } - public boolean isIgnored(Method eachMethod) { - return eachMethod.getAnnotation(Ignore.class) != null; + public boolean isIgnored(Method method) { + return method.getAnnotation(Ignore.class) != null; } private boolean runsTopToBottom(Class<? extends Annotation> annotation) { @@ -101,12 +117,15 @@ long getTimeout(Method method) { Test annotation= method.getAnnotation(Test.class); - long timeout= annotation.timeout(); - return timeout; + if (annotation == null) + return 0; + return annotation.timeout(); } Class<? extends Throwable> expectedException(Method method) { Test annotation= method.getAnnotation(Test.class); + if (annotation == null) + return null; if (annotation.expected() == None.class) return null; else |
From: David S. <ds...@us...> - 2006-12-27 22:27:25
|
Update of /cvsroot/junit/junit/src/org/junit/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23274/src/org/junit/runners Added Files: Replaces.java RunMethodWith.java MethodRunner.java Log Message: Another potential enhancement. RunMethodWith allows individual test methods to be run with different runners. --- NEW FILE: Replaces.java --- package org.junit.runners; import java.lang.annotation.Annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface Replaces { Class<? extends Annotation> value(); } --- NEW FILE: RunMethodWith.java --- package org.junit.runners; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface RunMethodWith { Class<? extends MethodRunner> value(); } --- NEW FILE: MethodRunner.java --- package org.junit.runners; import org.junit.internal.runners.TestMethod; import org.junit.runner.notification.RunNotifier; public interface MethodRunner { public abstract void run(TestMethod method, RunNotifier notifier); } |
From: Janette W. <ja...@ca...> - 2006-12-27 21:05:30
|
I will be out of the office starting 12/21/2006 and will not return until 01/08/2007. For business emergency, please contact my manager Christina Lau. |
From: Fran H. <fra...@ie...> - 2006-12-27 20:04:42
|
I will be out of the office starting 22/12/2006 and will not return until 02/01/2007. If you have any support issues/queries please raise a 199 call and assign them to the appropriate support team listed below; CDR Support :- EIENR_ASCDRAPPS BARCODE - EIEDN_SSLAMFGBC Maxcim/Tolas - EIEDN_SSLAVXLIV Thanks alot, Fran. |
From: David S. <ds...@us...> - 2006-12-27 17:45:59
|
Update of /cvsroot/junit/junit/src/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8678/src/org/junit/internal/runners Modified Files: MethodValidator.java BeforeAndAfterRunner.java TestIntrospector.java Added Files: MixIn.java Log Message: Added ability to "mix in" test elements from another class --- NEW FILE: MixIn.java --- package org.junit.internal.runners; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Inherited public @interface MixIn { Class<?>[] value(); } Index: MethodValidator.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/MethodValidator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MethodValidator.java 21 Nov 2006 18:53:34 -0000 1.1 +++ MethodValidator.java 27 Dec 2006 17:45:54 -0000 1.2 @@ -57,14 +57,15 @@ } private void validateTestMethods(Class<? extends Annotation> annotation, - boolean isStatic) { + boolean shouldBeStatic) { List<Method> methods= fIntrospector.getTestMethods(annotation); for (Method each : methods) { - if (Modifier.isStatic(each.getModifiers()) != isStatic) { - String state= isStatic ? "should" : "should not"; + if (shouldBeStatic && !isStatic(each)) fErrors.add(new Exception("Method " + each.getName() + "() " - + state + " be static")); - } + + "should be static")); + if (!shouldBeStatic && runsAsStatic(each)) + fErrors.add(new Exception("Method " + each.getName() + "() " + + "should not be static")); if (!Modifier.isPublic(each.getDeclaringClass().getModifiers())) fErrors.add(new Exception("Class " + each.getDeclaringClass().getName() + " should be public")); @@ -74,9 +75,24 @@ if (each.getReturnType() != Void.TYPE) fErrors.add(new Exception("Method " + each.getName() + " should be void")); - if (each.getParameterTypes().length != 0) + if (effectiveParameterCount(each, shouldBeStatic) != 0) fErrors.add(new Exception("Method " + each.getName() + " should have no parameters")); } } + + private int effectiveParameterCount(Method method, boolean shouldBeStatic) { + int rawLength= method.getParameterTypes().length; + if (!shouldBeStatic && isStatic(method) && rawLength > 0) + return rawLength - 1; + return rawLength; + } + + private boolean runsAsStatic(Method method) { + return isStatic(method) && !(method.getParameterTypes().length == 1); + } + + private boolean isStatic(Method method) { + return Modifier.isStatic(method.getModifiers()); + } } Index: BeforeAndAfterRunner.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/BeforeAndAfterRunner.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- BeforeAndAfterRunner.java 21 Nov 2006 18:53:34 -0000 1.1 +++ BeforeAndAfterRunner.java 27 Dec 2006 17:45:54 -0000 1.2 @@ -3,6 +3,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.util.List; public abstract class BeforeAndAfterRunner { @@ -71,6 +72,12 @@ } private void invokeMethod(Method method) throws Exception { - method.invoke(fTest); + if (Modifier.isStatic(method.getModifiers())) + if (method.getParameterTypes().length > 0) + method.invoke(null, fTest); + else + method.invoke(null); + else + method.invoke(fTest); } } Index: TestIntrospector.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/internal/runners/TestIntrospector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TestIntrospector.java 21 Nov 2006 18:53:34 -0000 1.1 +++ TestIntrospector.java 27 Dec 2006 17:45:54 -0000 1.2 @@ -12,67 +12,93 @@ import org.junit.Test; import org.junit.Test.None; - public class TestIntrospector { - private final Class< ?> fTestClass; - - public TestIntrospector(Class<?> testClass) { - fTestClass= testClass; - } + private static class MethodCollector { + private List<Method> methods= new ArrayList<Method>(); - public List<Method> getTestMethods(Class<? extends Annotation> annotationClass) { - List<Method> results= new ArrayList<Method>(); - for (Class<?> eachClass : getSuperClasses(fTestClass)) { - Method[] methods= eachClass.getDeclaredMethods(); - for (Method eachMethod : methods) { - Annotation annotation= eachMethod.getAnnotation(annotationClass); - if (annotation != null && ! isShadowed(eachMethod, results)) - results.add(eachMethod); + private Class<? extends Annotation> annotationClass; + + public MethodCollector(Class<? extends Annotation> annotationClass) { + this.annotationClass= annotationClass; + } + + public MethodCollector addMethods(Class<?> testClass) { + for (Method eachMethod : testClass.getDeclaredMethods()) { + Annotation annotation= eachMethod + .getAnnotation(annotationClass); + if (annotation != null && !isShadowed(eachMethod)) + methods.add(eachMethod); } + + addSuperclasses(testClass); + addMixins(testClass); + return this; } - if (runsTopToBottom(annotationClass)) - Collections.reverse(results); - return results; - } - public boolean isIgnored(Method eachMethod) { - return eachMethod.getAnnotation(Ignore.class) != null; - } + private void addMixins(Class<?> testClass) { + MixIn mixins= testClass.getAnnotation(MixIn.class); + if (mixins != null) + for (Class<?> type : mixins.value()) + addMethods(type); + } - private boolean runsTopToBottom(Class< ? extends Annotation> annotation) { - return annotation.equals(Before.class) || annotation.equals(BeforeClass.class); - } - - private boolean isShadowed(Method method, List<Method> results) { - for (Method each : results) { - if (isShadowed(method, each)) - return true; + private void addSuperclasses(Class<?> testClass) { + Class<?> superclass= testClass.getSuperclass(); + if (superclass != null) + addMethods(testClass.getSuperclass()); } - return false; - } - private boolean isShadowed(Method current, Method previous) { - if (! previous.getName().equals(current.getName())) - return false; - if (previous.getParameterTypes().length != current.getParameterTypes().length) + private boolean isShadowed(Method method) { + for (Method each : methods) { + if (isShadowed(method, each)) + return true; + } return false; - for (int i= 0; i < previous.getParameterTypes().length; i++) { - if (! previous.getParameterTypes()[i].equals(current.getParameterTypes()[i])) + } + + private boolean isShadowed(Method current, Method previous) { + if (!previous.getName().equals(current.getName())) return false; + if (previous.getParameterTypes().length != current + .getParameterTypes().length) + return false; + for (int i= 0; i < previous.getParameterTypes().length; i++) { + if (!previous.getParameterTypes()[i].equals(current + .getParameterTypes()[i])) + return false; + } + return true; } - return true; - } - private List<Class<?>> getSuperClasses(Class< ?> testClass) { - ArrayList<Class<?>> results= new ArrayList<Class<?>>(); - Class<?> current= testClass; - while (current != null) { - results.add(current); - current= current.getSuperclass(); + public List<Method> getMethods() { + return methods; } + } + + private final Class<?> fTestClass; + + public TestIntrospector(Class<?> testClass) { + fTestClass= testClass; + } + + public List<Method> getTestMethods( + Class<? extends Annotation> annotationClass) { + List<Method> results= new MethodCollector(annotationClass).addMethods( + fTestClass).getMethods(); + if (runsTopToBottom(annotationClass)) + Collections.reverse(results); return results; } + public boolean isIgnored(Method eachMethod) { + return eachMethod.getAnnotation(Ignore.class) != null; + } + + private boolean runsTopToBottom(Class<? extends Annotation> annotation) { + return annotation.equals(Before.class) + || annotation.equals(BeforeClass.class); + } + long getTimeout(Method method) { Test annotation= method.getAnnotation(Test.class); long timeout= annotation.timeout(); @@ -88,4 +114,3 @@ } } - |
From: David S. <ds...@us...> - 2006-12-27 17:45:59
|
Update of /cvsroot/junit/junit/src/org/junit/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8678/src/org/junit/runners Modified Files: Parameterized.java Log Message: Added ability to "mix in" test elements from another class Index: Parameterized.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/runners/Parameterized.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Parameterized.java 21 Nov 2006 18:53:41 -0000 1.1 +++ Parameterized.java 27 Dec 2006 17:45:54 -0000 1.2 @@ -120,7 +120,7 @@ } private Collection<?> getParametersList() throws IllegalAccessException, InvocationTargetException, Exception { - return (Collection) getParametersMethod().invoke(null); + return (Collection<?>) getParametersMethod().invoke(null); } private Method getParametersMethod() throws Exception { |
From: David S. <ds...@us...> - 2006-12-27 17:45:58
|
Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8678/src/org/junit/tests Modified Files: AllTests.java Added Files: MixInTest.java Removed Files: CustomRunnerTest.java Log Message: Added ability to "mix in" test elements from another class --- NEW FILE: MixInTest.java --- package org.junit.tests; import static org.junit.Assert.*; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.internal.runners.MixIn; import org.junit.runner.JUnitCore; import org.junit.runner.Result; public class MixInTest { private static final String GLOBAL_STATE_IS_INVALID= "global state is invalid"; public static class CustomTest { @Before public static void assertGlobalStateIsValid(Object test) { Assert.fail(GLOBAL_STATE_IS_INVALID); } } @MixIn(CustomTest.class) public static class UsesGlobalState { @Test public void foo() { } } @Test public void failsWithGlobalState() { Result result= JUnitCore.runClasses(UsesGlobalState.class); assertEquals(1, result.getFailureCount()); assertEquals(GLOBAL_STATE_IS_INVALID, result.getFailures().get(0) .getMessage()); } public static class ExtraTest { @Test public static void bar(Object test) { } } @MixIn({CustomTest.class, ExtraTest.class}) public static class Combined { } @Test public void extendWithMultipleClasses() { Result result= JUnitCore.runClasses(UsesGlobalState.class); assertEquals(1, result.getFailureCount()); assertEquals(GLOBAL_STATE_IS_INVALID, result.getFailures().get(0) .getMessage()); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AllTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AllTests.java 13 Dec 2006 02:10:51 -0000 1.3 +++ AllTests.java 27 Dec 2006 17:45:54 -0000 1.4 @@ -10,7 +10,7 @@ @SuiteClasses({ ListenerTest.class, FailedConstructionTest.class, - CustomRunnerTest.class, + MixInTest.class, TestDescriptionTest.class, SuiteDescriptionTest.class, AllTestsTest.class, --- CustomRunnerTest.java DELETED --- |