Skip to content

Commit 2f879b9

Browse files
author
David Saff
committed
Merge pull request #526 from marcphilipp/release-notes-file-extension
Change to Markdown extension for ease of viewing
2 parents e7090d1 + c09de4d commit 2f879b9

23 files changed

+1064
-1053
lines changed

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
<property name="basename" value="doc/ReleaseNotes${version-base}" />
134134
<exec executable="perl" failonerror="true">
135135
<arg file="build/Markdown.pl"/>
136-
<arg file="${basename}.txt"/>
136+
<arg file="${basename}.md"/>
137137
<redirector output="${basename}.html" />
138138
</exec>
139139
</target>

doc/ReleaseNotes4.10.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## Summary of Changes in version 4.10 ##
2+
3+
Thanks to a full cast of contributors of bug fixes and new features.
4+
5+
A full summary of commits between 4.9 and 4.10 is on [github](https://github.com/KentBeck/junit/compare/r4.9...4.10)
6+
7+
### junit-dep has correct contents ###
8+
9+
junit-dep-4.9.jar incorrectly contained hamcrest classes, which could lead to version conflicts in projects that depend on hamcrest directly. This is fixed in 4.10 [@dsaff, closing gh-309]
10+
11+
### RuleChain ###
12+
13+
The RuleChain rule allows ordering of TestRules:
14+
15+
public static class UseRuleChain {
16+
@Rule
17+
public TestRule chain= RuleChain
18+
.outerRule(new LoggingRule("outer rule")
19+
.around(new LoggingRule("middle rule")
20+
.around(new LoggingRule("inner rule");
21+
22+
@Test
23+
public void example() {
24+
assertTrue(true);
25+
}
26+
}
27+
28+
writes the log
29+
30+
starting outer rule
31+
starting middle rule
32+
starting inner rule
33+
finished inner rule
34+
finished middle rule
35+
finished outer rule
36+
37+
### TemporaryFolder ###
38+
39+
- `TemporaryFolder#newFolder(String... folderNames)` creates recursively deep temporary folders
40+
[@rodolfoliviero, closing gh-283]
41+
- `TemporaryFolder#newFile()` creates a randomly named new file, and `#newFolder()` creates a randomly named new folder
42+
[@Daniel Rothmaler, closing gh-299]
43+
44+
### Theories ###
45+
46+
The `Theories` runner does not anticipate theory parameters that have generic
47+
types, as reported by github#64. Fixing this won't happen until `Theories` is
48+
moved to junit-contrib. In anticipation of this, 4.9.1 adds some of the
49+
necessary machinery to the runner classes, and deprecates a method that only
50+
the `Theories` runner uses, `FrameworkMethod`#producesType().
51+
The Common Public License that JUnit is released under is now included
52+
in the source repository.
53+
54+
Thanks to `@pholser` for identifying a potential resolution for github#64
55+
and initiating work on it.
56+
57+
### Bug fixes ###
58+
59+
- Built-in Rules implementations
60+
- TemporaryFolder should not create files in the current working directory if applying the rule fails
61+
[@orfjackal, fixing gh-278]
62+
- TestWatcher and TestWatchman should not call failed for AssumptionViolatedExceptions
63+
[@stefanbirkner, fixing gh-296]
64+
- Javadoc bugs
65+
- Assert documentation [@stefanbirkner, fixing gh-134]
66+
- ClassRule [@stefanbirkner, fixing gh-254]
67+
- Parameterized [@stefanbirkner, fixing gh-89]
68+
- Parameterized, again [@orfjackal, fixing gh-285]
69+
- Miscellaneous
70+
- Useless code in RunAfters [@stefanbirkner, fixing gh-289]
71+
- Parameterized test classes should be able to have `@Category` annotations
72+
[@dsaff, fixing gh-291]
73+
- Error count should be initialized in junit.tests.framework.TestListenerTest [@stefanbirkner, fixing gh-225]
74+
- AssertionFailedError constructor shouldn't call super with null message [@stefanbirkner, fixing gh-318]
75+
- Clearer error message for non-static inner test classes [@stefanbirkner, fixing gh-42]
76+
77+
### Minor changes ###
78+
79+
- Description, Result and Failure are Serializable [@ephox-rob, closing gh-101]
80+
- FailOnTimeout is reusable, allowing for retrying Rules [@stefanbirkner, closing gh-265]
81+
- New `ErrorCollector.checkThat` overload, that allows you to specify a reason [@drothmaler, closing gh-300]
82+
83+
84+

doc/ReleaseNotes4.10.txt

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1 @@
1-
## Summary of Changes in version 4.10 ##
2-
3-
Thanks to a full cast of contributors of bug fixes and new features.
4-
5-
A full summary of commits between 4.9 and 4.10 is on [github](https://github.com/KentBeck/junit/compare/r4.9...4.10)
6-
7-
### junit-dep has correct contents ###
8-
9-
junit-dep-4.9.jar incorrectly contained hamcrest classes, which could lead to version conflicts in projects that depend on hamcrest directly. This is fixed in 4.10 [@dsaff, closing gh-309]
10-
11-
### RuleChain ###
12-
13-
The RuleChain rule allows ordering of TestRules:
14-
15-
public static class UseRuleChain {
16-
@Rule
17-
public TestRule chain= RuleChain
18-
.outerRule(new LoggingRule("outer rule")
19-
.around(new LoggingRule("middle rule")
20-
.around(new LoggingRule("inner rule");
21-
22-
@Test
23-
public void example() {
24-
assertTrue(true);
25-
}
26-
}
27-
28-
writes the log
29-
30-
starting outer rule
31-
starting middle rule
32-
starting inner rule
33-
finished inner rule
34-
finished middle rule
35-
finished outer rule
36-
37-
### TemporaryFolder ###
38-
39-
- `TemporaryFolder#newFolder(String... folderNames)` creates recursively deep temporary folders
40-
[@rodolfoliviero, closing gh-283]
41-
- `TemporaryFolder#newFile()` creates a randomly named new file, and `#newFolder()` creates a randomly named new folder
42-
[@Daniel Rothmaler, closing gh-299]
43-
44-
### Theories ###
45-
46-
The `Theories` runner does not anticipate theory parameters that have generic
47-
types, as reported by github#64. Fixing this won't happen until `Theories` is
48-
moved to junit-contrib. In anticipation of this, 4.9.1 adds some of the
49-
necessary machinery to the runner classes, and deprecates a method that only
50-
the `Theories` runner uses, `FrameworkMethod`#producesType().
51-
The Common Public License that JUnit is released under is now included
52-
in the source repository.
53-
54-
Thanks to `@pholser` for identifying a potential resolution for github#64
55-
and initiating work on it.
56-
57-
### Bug fixes ###
58-
59-
- Built-in Rules implementations
60-
- TemporaryFolder should not create files in the current working directory if applying the rule fails
61-
[@orfjackal, fixing gh-278]
62-
- TestWatcher and TestWatchman should not call failed for AssumptionViolatedExceptions
63-
[@stefanbirkner, fixing gh-296]
64-
- Javadoc bugs
65-
- Assert documentation [@stefanbirkner, fixing gh-134]
66-
- ClassRule [@stefanbirkner, fixing gh-254]
67-
- Parameterized [@stefanbirkner, fixing gh-89]
68-
- Parameterized, again [@orfjackal, fixing gh-285]
69-
- Miscellaneous
70-
- Useless code in RunAfters [@stefanbirkner, fixing gh-289]
71-
- Parameterized test classes should be able to have `@Category` annotations
72-
[@dsaff, fixing gh-291]
73-
- Error count should be initialized in junit.tests.framework.TestListenerTest [@stefanbirkner, fixing gh-225]
74-
- AssertionFailedError constructor shouldn't call super with null message [@stefanbirkner, fixing gh-318]
75-
- Clearer error message for non-static inner test classes [@stefanbirkner, fixing gh-42]
76-
77-
### Minor changes ###
78-
79-
- Description, Result and Failure are Serializable [@ephox-rob, closing gh-101]
80-
- FailOnTimeout is reusable, allowing for retrying Rules [@stefanbirkner, closing gh-265]
81-
- New `ErrorCollector.checkThat` overload, that allows you to specify a reason [@drothmaler, closing gh-300]
82-
83-
84-
1+
Please see ReleaseNotes4.10.md

doc/ReleaseNotes4.11.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
## Summary of changes in version 4.11 [unreleased!]
2+
3+
### Matchers: Upgrade to Hamcrest 1.3
4+
5+
JUnit now uses the latest version of Hamcrest. Thus, you can use all the available matchers and benefit from an improved `assertThat` which will now print the mismatch description from the matcher when an assertion fails.
6+
7+
#### Example
8+
9+
assertThat(Long.valueOf(1), instanceOf(Integer.class));
10+
11+
Old error message:
12+
13+
Expected: an instance of java.lang.Integer
14+
got: <1L>
15+
16+
New error message:
17+
18+
Expected: an instance of java.lang.Integer
19+
but: <1L> is a java.lang.Long
20+
21+
Hamcrest's new `FeatureMatcher` makes writing custom matchers that make use of custom mismatch descriptions quite easy:
22+
23+
@Test
24+
public void featureMatcher() throws Exception {
25+
assertThat("Hello World!", length(is(0)));
26+
}
27+
28+
private Matcher<String> length(Matcher<? super Integer> matcher) {
29+
return new FeatureMatcher<String, Integer>(matcher, "a String of length that", "length") {
30+
@Override
31+
protected Integer featureValueOf(String actual) {
32+
return actual.length();
33+
}
34+
};
35+
}
36+
37+
Running this test will return the following failure message:
38+
39+
Expected: a String of length that is <0>
40+
but: length was <12>
41+
42+
43+
Most of the matchers in `JUnitMatchers` have been deprecated. Please use `org.hamcrest.CoreMatchers` directly.
44+
45+
### Parameterized Tests
46+
47+
In order to easily identify the individual test cases in a Parameterized test, you may provide a name using the `@Parameters` annotation. This name is allowed to contain placeholders that are replaced at runtime:
48+
49+
* `{index}`: the current parameter index
50+
* `{0}`, `{1}`, …: the first, second, and so on, parameter value
51+
52+
#### Example
53+
54+
@RunWith(Parameterized.class)
55+
public class FibonacciTest {
56+
57+
@Parameters(name = "{index}: fib({0})={1}")
58+
public static Iterable<Object[]> data() {
59+
return Arrays.asList(new Object[][] { { 0, 0 }, { 1, 1 }, { 2, 1 },
60+
{ 3, 2 }, { 4, 3 }, { 5, 5 }, { 6, 8 } });
61+
}
62+
63+
private int input;
64+
private int expected;
65+
66+
public FibonacciTest(int input, int expected) {
67+
this.input = input;
68+
this.expected = expected;
69+
}
70+
71+
@Test
72+
public void test() {
73+
assertEquals(expected, Fibonacci.compute(input));
74+
}
75+
}
76+
77+
In the example given above, the `Parameterized` runner creates names like `[1: fib(3)=2]`. If you don't specify a name, the current parameter index will be used by default.
78+
79+
### Test execution order
80+
81+
By design, JUnit does not specify the execution order of test method invocations. Until now, the methods were simply invoked in the order returned by the reflection API. However, using the JVM order is unwise since the Java platform does not specify any particular order, and in fact JDK 7 returns a more or less random order. Of course, well-written test code would not assume any order, but some does, and a predictable failure is better than a random failure on certain platforms.
82+
83+
From now on, JUnit will by default use a deterministic, but not predictable, order (`MethodSorters.DEFAULT`). To change the test execution order simply annotate your test class using `@FixMethodOrder` and specify one of the available `MethodSorters`:
84+
85+
* `@FixMethodOrder(MethodSorters.JVM)`: Leaves the test methods in the order returned by the JVM. This order may vary from run to run.
86+
87+
* `@FixMethodOrder(MethodSorters.NAME_ASCENDING)`: Sorts the test methods by method name, in lexicographic order.
88+
89+
### Maven artifacts
90+
91+
Up until now there were two Maven artifacts for JUnit: `junit:junit-dep` and `junit:junit`. From a Maven point-of-view only the former made sense because it did not contain the Hamcrest classes but declared a dependency to the Hamcrest Maven artifact. The latter included the Hamcrest classes which was very un-Maven-like.
92+
93+
From this release on, you should use `junit:junit` which will be what `junit:junit-dep` used to. If you still reference `junit:junit-dep`, Maven will automatically relocate you to the new `junit:junit` and issue a warning for you to fix.
94+
95+
### Rules
96+
97+
A number of improvements have been made to Rules:
98+
99+
* Both `@Rule` and `@ClassRule` can now be used on methods that return a `TestRule`.
100+
* `ExpectedException` now always prints the stacktrace of the actual exception in case of failure.
101+
* A parent folder can be specified for `TemporaryFolder`. In addition, the `newFile`/`newFolder` methods will now fail when the file or folder could not be created.
102+
* `TestWatcher` has a new template method called `skipped` that is invoked when a test is skipped due to a failed assumption.
103+
104+
### Improvements to Assert and Assume
105+
106+
* `assertNotEquals` has been added to `Assert`.
107+
* `assertEquals` has been overloaded in order to check whether two floats are equal given a certain float delta.
108+
* Most methods in `Assume` now allow to pass a custom message.
109+

0 commit comments

Comments
 (0)