Permalink
Browse files

Merging from remote

  • Loading branch information...
2 parents dcd07b1 + db9a456 commit 45cee89178172749b7f75be3944d9aa367d97373 @detinho committed Mar 27, 2012
Showing with 2,972 additions and 324 deletions.
  1. +49 −1 acknowledgements.txt
  2. +63 −22 build.xml
  3. BIN build/lib/ant-contrib-1.0b3.jar
  4. 0 { → build/maven}/pom-template.xml
  5. +49 −0 build/maven/post_maven_tests.sh
  6. +61 −0 build/maven/sample_project_template/pom.xml
  7. +33 −0 build/maven/sample_project_template/src/test/java/JunitDependencyTest.java
  8. +36 −0 build/run_tests.sh
  9. +1 −34 build_tests.sh
  10. +93 −0 doc/ReleaseNotes4.10.html
  11. +84 −0 doc/ReleaseNotes4.10.txt
  12. +1 −0 doc/ReleaseNotes4.11.html
  13. +1 −0 doc/ReleaseNotes4.11.txt
  14. +14 −0 doc/ReleaseNotes4.9.1.txt
  15. +1 −1 doc/ReleaseNotes4.9.html
  16. +1 −1 doc/ReleaseNotes4.9.txt
  17. +0 −12 pom-template.xml.asc
  18. +5 −1 src/main/java/junit/framework/AssertionFailedError.java
  19. +2 −1 src/main/java/junit/framework/TestSuite.java
  20. +1 −1 src/main/java/junit/runner/Version.java
  21. +14 −4 src/main/java/org/junit/Assert.java
  22. +32 −6 src/main/java/org/junit/ClassRule.java
  23. +29 −6 src/main/java/org/junit/Rule.java
  24. +1 −0 src/main/java/org/junit/experimental/theories/internal/AllMembersSupplier.java
  25. +35 −0 src/main/java/org/junit/internal/MethodSorter.java
  26. +2 −1 src/main/java/org/junit/internal/matchers/TypeSafeMatcher.java
  27. +2 −1 src/main/java/org/junit/internal/runners/TestClass.java
  28. +112 −0 src/main/java/org/junit/internal/runners/rules/RuleFieldValidator.java
  29. +47 −22 src/main/java/org/junit/internal/runners/statements/FailOnTimeout.java
  30. +0 −1 src/main/java/org/junit/internal/runners/statements/RunAfters.java
  31. +14 −5 src/main/java/org/junit/rules/ErrorCollector.java
  32. +99 −0 src/main/java/org/junit/rules/RuleChain.java
  33. +41 −14 src/main/java/org/junit/rules/TemporaryFolder.java
  34. +3 −0 src/main/java/org/junit/rules/TestWatcher.java
  35. +3 −0 src/main/java/org/junit/rules/TestWatchman.java
  36. +4 −2 src/main/java/org/junit/runner/Description.java
  37. +1 −8 src/main/java/org/junit/runner/JUnitCore.java
  38. +3 −1 src/main/java/org/junit/runner/Result.java
  39. +3 −1 src/main/java/org/junit/runner/notification/Failure.java
  40. +36 −37 src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java
  41. +52 −36 src/main/java/org/junit/runners/Parameterized.java
  42. +23 −22 src/main/java/org/junit/runners/ParentRunner.java
  43. +20 −1 src/main/java/org/junit/runners/model/FrameworkField.java
  44. +6 −1 src/main/java/org/junit/runners/model/FrameworkMember.java
  45. +48 −5 src/main/java/org/junit/runners/model/FrameworkMethod.java
  46. +53 −0 src/main/java/org/junit/runners/model/NoGenericTypeParametersValidator.java
  47. +25 −2 src/main/java/org/junit/runners/model/TestClass.java
  48. +3 −1 src/test/java/junit/samples/SimpleTest.java
  49. +1 −0 src/test/java/junit/tests/framework/AllTests.java
  50. +23 −0 src/test/java/junit/tests/framework/AssertionFailedErrorTest.java
  51. +1 −0 src/test/java/junit/tests/framework/TestListenerTest.java
  52. +2 −1 src/test/java/junit/tests/runner/AllTests.java
  53. +37 −0 src/test/java/junit/tests/runner/ResultTest.java
  54. +34 −0 src/test/java/org/junit/internal/MethodSorterTest.java
  55. +3 −1 src/test/java/org/junit/samples/SimpleTest.java
  56. +10 −2 src/test/java/org/junit/tests/AllTests.java
  57. +32 −16 src/test/java/org/junit/tests/experimental/categories/CategoriesAndParameterizedTest.java
  58. +0 −2 src/test/java/org/junit/tests/experimental/categories/CategoryTest.java
  59. +137 −1 src/test/java/org/junit/tests/experimental/rules/ClassRulesTest.java
  60. +32 −0 src/test/java/org/junit/tests/experimental/rules/LoggingTestWatcher.java
  61. +60 −0 src/test/java/org/junit/tests/experimental/rules/RuleChainTest.java
  62. +189 −0 src/test/java/org/junit/tests/experimental/rules/RuleFieldValidatorTest.java
  63. +137 −8 src/test/java/org/junit/tests/experimental/rules/TempFolderRuleTest.java
  64. +144 −0 src/test/java/org/junit/tests/experimental/rules/TemporaryFolderUsageTest.java
  65. +378 −26 src/test/java/org/junit/tests/experimental/rules/TestRuleTest.java
  66. +52 −0 src/test/java/org/junit/tests/experimental/rules/TestWatcherTest.java
  67. +72 −0 src/test/java/org/junit/tests/experimental/rules/TestWatchmanTest.java
  68. +8 −0 src/test/java/org/junit/tests/experimental/rules/VerifierRuleTest.java
  69. +177 −0 ...org/junit/tests/experimental/theories/runner/WithUnresolvedGenericTypeVariablesOnTheoryParms.java
  70. +110 −0 src/test/java/org/junit/tests/internal/runners/statements/FailOnTimeoutTest.java
  71. +33 −0 src/test/java/org/junit/tests/running/classes/BlockJUnit4ClassRunnerTest.java
  72. +32 −15 src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java
  73. +27 −1 src/test/java/org/junit/tests/running/classes/ParentRunnerTest.java
  74. +35 −0 src/test/java/org/junit/tests/running/classes/TestClassTest.java
View
@@ -104,8 +104,56 @@
Samuel Le Berrigaud (sleberrigaud@github): Report for GH-248:
protected BlockJUnit4ClassRunner#rules method removed from 4.8.2
+2011 Jun 24
+ Daniel Rothmaler (drothmaler@github):
+ #299: random temp file/folder creation
+ #300: ErrorCollector.checkThat overload
+
2011 Jul 06
- Stefan Birkner: Fixed wrong docomentation of ClassRule (github#254).
+ Stefan Birkner: Fixed wrong documentation of ClassRule (github#254).
+
+2011 Jul 08
+ Paul Holser (pholser@alumni.rice.edu): Beginnings of fix for GH-64:
+ Theories doesn't honor parameterized types
+
+2011 Jul 09
+ Nigel Charman: Reported Rules bugs github#257 and gihub#258.
+
+2011 Jul 09
+ Stefan Birkner: Fixed rules bugs (github#257, gihub#258, github#260).
+
+2011 Jul 09
+ Stefan Birkner: Fixed rules bugs (github#257, gihub#258, github#260).
+
+2011 Jul 16
+ Rob Dawson: Submitted a patch that makes Results serlializable.
+
+2011 Jul 20
+ Asaf Ary, Stefan Birkner: Fixed FailOnTimeout class (github#265).
2011 Jul 22
Andreas Köhler, Stefan Birkner: Fixed wrong documentation of Parameterized (github#89).
+
+2011 Jul 28
+ electrickery, Stefan Birkner: Fixed typo in JavaDoc (github#134).
+
+2011 Aug 07
+ Esko Luontola: Fixed TemporaryFolder creating files in the current working directory (github#278).
+
+2011 Aug 09
+ Stefan Birkner: Fixed JavaDoc links.
+
+2011 Aug 10
+ rodolfoliviero@github and JoseRibeiro@github: feature to create recursive temporary folders.
+
+2011 Aug 12
+ Esko Luontola: Fixed syntax error in Parameterized's usage example (github#285).
+
+2011 Sep 09
+ Robert Munteanu, Stefan Birkner:
+ TestWatcher and TestWatchman don't call failed when assumption is violated (github#296).
+ digulla@github, Stefan Birkner: Removed useless code (github#289).
+
+== NOTE: as of September 2011, we have stopped recording contributions here.
+ For a full list of everyone who has contributed great bug reports and code, please see
+ http://github.com/KentBeck/junit
View
@@ -1,13 +1,14 @@
<project name="junit" default="dist" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<tstamp />
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<property file="${user.home}/.junit.properties" />
<property name="src" value="src/main/java" />
<property name="target" location="target" />
<property name="bin" location="${target}/main" />
- <property name="version-base" value="4.9" />
- <property name="version-status" value="b3" />
+ <property name="version-base" value="4.11" />
+ <property name="version-status" value="-SNAPSHOT" />
<property name="version" value="${version-base}${version-status}" />
<property name="dist" value="junit${version}" />
<property name="versionfile" value="${src}/junit/runner/Version.java" />
@@ -67,6 +68,7 @@
debug="on"
classpath="@{classpath}"
includeantruntime="false"
+ source="1.5"
target="1.5"
>
<compilerarg value="-Xlint:unchecked" />
@@ -131,7 +133,8 @@
<target name="release-notes">
<property name="basename" value="doc/ReleaseNotes${version-base}" />
- <exec executable="build/Markdown.pl">
+ <exec executable="perl" failonerror="true">
+ <arg file="build/Markdown.pl"/>
<arg file="${basename}.txt"/>
<redirector output="${basename}.html" />
</exec>
@@ -217,19 +220,18 @@
<!-- to do automatic build upload, you need the maven ant tasks jar. -->
<!-- therefore, you must run ant as ant -lib build/lib stage.maven -->
- <macrodef name="stage.maven.jar">
+ <macrodef name="push.maven.jar">
<attribute name="jar" />
<attribute name="pom" />
+ <attribute name="url" />
+ <attribute name="repo.id" />
<element name="artifact.args" implicit="true" optional="true" />
<sequential>
- <property name="maven-repository-url"
- value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
- <property name="maven-repository-id" value="sonatype-nexus-staging" />
- <echo message="Staging to maven: @{jar}" />
+ <echo message="Pushing to maven: @{jar} -> @{url}" />
<artifact:mvn failonerror="true">
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
- <arg value="-Durl=${maven-repository-url}" />
- <arg value="-DrepositoryId=${maven-repository-id}" />
+ <arg value="-Durl=@{url}" />
+ <arg value="-DrepositoryId=@{repo.id}" />
<arg value="-DpomFile=@{pom}" />
<arg value="-Dfile=@{jar}" />
<artifact.args />
@@ -238,40 +240,79 @@
</sequential>
</macrodef>
- <macrodef name="stage.maven.artifactId">
+ <macrodef name="push.maven.artifact">
<attribute name="artifactId" />
+ <attribute name="url" />
+ <attribute name="repo.id" />
+ <attribute name="is.snapshot" default="false" />
<sequential>
+ <local name="m.prefix" />
<property name="m.prefix" value="${dist}/@{artifactId}-${version}" />
+ <local name="m.jar" />
<property name="m.jar" value="${m.prefix}.jar" />
+ <local name="m.sources.jar" />
<property name="m.sources.jar" value="${m.prefix}-src.jar" />
+ <local name="m.javadoc.jar" />
<property name="m.javadoc.jar" value="${m.prefix}-javadoc.jar" />
+ <local name="m.pom" />
<property name="m.pom" value="${dist}/pom-@{artifactId}.xml" />
<filter token="version" value="${version}" />
<filter token="artifactId" value="@{artifactId}" />
<copy
- file="pom-template.xml"
+ file="build/maven/pom-template.xml"
tofile="${m.pom}"
filtering="on"
overwrite="true"
/>
- <stage.maven.jar jar="${m.jar}" pom="${m.pom}" />
-
- <stage.maven.jar jar="${m.sources.jar}" pom="${m.pom}" >
- <arg value="-Dclassifier=sources" />
- </stage.maven.jar>
+ <push.maven.jar jar="${m.jar}" pom="${m.pom}"
+ url="@{url}" repo.id="@{repo.id}" />
+
+ <if>
+ <equals arg1="@{is.snapshot}" arg2="false" />
+ <then>
+ <push.maven.jar jar="${m.sources.jar}" pom="${m.pom}"
+ url="@{url}" repo.id="@{repo.id}">
+ <arg value="-Dclassifier=sources" />
+ </push.maven.jar>
- <stage.maven.jar jar="${m.javadoc.jar}" pom="${m.pom}" >
- <arg value="-Dclassifier=javadoc" />
- </stage.maven.jar>
+ <push.maven.jar jar="${m.javadoc.jar}" pom="${m.pom}"
+ url="@{url}" repo.id="@{repo.id}">
+ <arg value="-Dclassifier=javadoc" />
+ </push.maven.jar>
+ </then>
+ </if>
</sequential>
</macrodef>
<target name="stage.maven" depends="all.maven.jars">
- <stage.maven.artifactId artifactId="junit" />
- <stage.maven.artifactId artifactId="junit-dep" />
+ <property name="stage.url"
+ value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
+ <property name="stage.repo.id" value="sonatype-nexus-staging" />
+
+ <push.maven.artifact artifactId="junit"
+ url="${stage.url}"
+ repo.id="${stage.repo.id}"
+ is.snapshot="false" />
+ <push.maven.artifact artifactId="junit-dep"
+ url="${stage.url}"
+ repo.id="${stage.repo.id}"
+ is.snapshot="false" />
+ </target>
+
+ <target name="snapshot.maven" depends="all.maven.jars">
+ <property name="snapshot.url"
+ value="https://oss.sonatype.org/content/repositories/snapshots/" />
+ <property name="snapshot.repo.id" value="sonatype-nexus-snapshots" />
+
+ <push.maven.artifact artifactId="junit"
+ url="${snapshot.url}"
+ repo.id="${snapshot.repo.id}" />
+ <push.maven.artifact artifactId="junit-dep"
+ url="${snapshot.url}"
+ repo.id="${snapshot.repo.id}" />
</target>
<target name="print.version">
Binary file not shown.
File renamed without changes.
@@ -0,0 +1,49 @@
+set -e
+set -o pipefail
+
+function TEST_junit_dep_49_plays_not_nicely_with_later_hamcrest {
+ # Make sure our system notices the bug (this broke because of a bad push)
+ ! runs_with_newer_hamcrest junit-dep 4.9
+}
+
+function TEST_junit_dep_snapshot_plays_nicely_with_later_hamcrest {
+ runs_with_newer_hamcrest junit-dep LATEST
+}
+
+function TEST_junit_snapshot_plays_not_nicely_with_later_hamcrest {
+ ! runs_with_newer_hamcrest junit LATEST
+}
+
+function runs_with_newer_hamcrest {
+ local artifact_id=$1
+ local version=$2
+ rm -rf ~/.m2/repository/junit
+ rm -rf uses_junit
+ cp -r sample_project_template uses_junit
+ sed -i '' -e "s/___ARTIFACT_ID___/$artifact_id/" uses_junit/pom.xml
+ sed -i '' -e "s/___VERSION___/$version/" uses_junit/pom.xml
+ in_dir uses_junit mvn test
+ finally rm -rf uses_junit
+}
+
+### <copied src="https://gist.github.com/1206506">
+function in_dir {
+ local dir=$1
+ shift
+ if [ ! -e $dir ]; then
+ echo "$dir does not exist"
+ return 1
+ fi
+ pushd $dir >/dev/null
+ "$@"
+ finally popd >/dev/null
+}
+
+function finally {
+ local return_this=$?
+ "$@"
+ return $return_this
+}
+### </copied>
+
+source ../run_tests.sh
@@ -0,0 +1,61 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.example</groupId>
+ <artifactId>junit-dependency-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <version.hamcrest>1.2.1</version.hamcrest>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>___ARTIFACT_ID___</artifactId>
+ <version>___VERSION___</version>
+ </dependency>
+
+ <!--
+ This dependency must be included *before* junit, because said JAR
+ contains an old hamcrest-core version. This is problematic at
+ runtime; see JunitDependencyTest.
+ If junit-dep has the right contents, the order should not matter.
+ -->
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <version>${version.hamcrest}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <version>${version.hamcrest}</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>Sonatype</id>
+ <url>https://oss.sonatype.org/content/groups/public</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ <releases><enabled>true</enabled></releases>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,33 @@
+import org.hamcrest.Matchers;
+import org.junit.Test;
+
+public final class JunitDependencyTest {
+ /**
+ * JUnit dependency test.
+ *
+ * This class has three dependencies. These can be on the classpath in
+ * different orders. Of the two orderings below, the first one will cause a
+ * NoSuchMethodError, while the second one allows the test to pass
+ * successfully. See the explanation below for more information.
+ *
+ * Ordering 1: junit-4.9, hamcrest-core-1.2.1, hamcrest-library-1.2.1.
+ * Ordering 2: hamcrest-core-1.2.1, junit-4.9, hamcrest-library-1.2.1.
+ */
+ @Test
+ public void test() {
+ /*
+ * Note that we call Matchers#anyOf(Matcher<T>, Matcher<? super T>).
+ * This method is provided by hamcrest-library-1.2.1. Said module is
+ * compiled against hamcrest-core-1.2.1. Matchers#anyOf calls
+ * AnyOf#anyOf(Matcher<T>, Matcher<? super T>). The latter method is
+ * provided by hamcrest-core-1.2.1, but *not* by hamcrest-core-1.1.
+ *
+ * However, hamcrest-core-1.1 *does* contain a class called AnyOf. Now,
+ * since junit-4.9 incorporates hamcrest-core-1.1 we must make sure that
+ * hamcrest-core-1.2.1 is placed *before* junit-4.9 on the classpath.
+ * Failure to do so will cause the wrong AnyOf class to be used. The
+ * result is a NoSuchMethodError.
+ */
+ Matchers.anyOf(Matchers.nullValue(), Matchers.notNullValue());
+ }
+}
View
@@ -0,0 +1,36 @@
+# See maven/post_maven_tests.sh for an example use
+
+SCRIPT_NAME=$0
+TEST_NAME=${1:-ALL}
+
+function get_tests() {
+ if [ $TEST_NAME == "ALL" ]; then
+ part1=function
+ part2=TEST_
+ grep "$part1 $part2" $SCRIPT_NAME | sed 's/.*\(TEST_[A-Za-z0-9_]*\).*/\1/'
+ else
+ echo "TEST_${TEST_NAME}"
+ fi
+}
+
+function run_tests() {
+ local exit_code=0
+
+ for t in $(get_tests); do
+ echo "RUNNING: $t"
+ if "$t"; then
+ echo "PASSED: $t"
+ else
+ echo "FAILED: $t"
+ return 1
+ fi
+ done
+}
+
+if run_tests; then
+ echo "ALL TESTS PASSED"
+ exit 0
+else
+ echo "A TEST FAILED"
+ exit 1
+fi
Oops, something went wrong.

0 comments on commit 45cee89

Please sign in to comment.