Skip to content

Commit 77450c7

Browse files
committed
Merge pull request #1024 from kcooney/update-release-notes
Add missing pull requests from 4.12 release notes
2 parents c508fc4 + 417add3 commit 77450c7

File tree

1 file changed

+84
-3
lines changed

1 file changed

+84
-3
lines changed

doc/ReleaseNotes4.12.md

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ In the usual case, where the array elements are in fact exactly equal, the poten
2020
# Test Runners
2121

2222

23-
### [Pull request #817:] (https://github.com/junit-team/junit/pull/817) Support for context hierarchies
23+
### [Pull request #763:](https://github.com/junit-team/junit/pull/763) Allow custom test runners to create their own TestClasses and customize the scanning of annotations.
24+
25+
This introduces some extension points to `ParentRunner` to allow subclasse to control creation
26+
of the `TestClass` instance and to scan for annotations.
27+
28+
### [Pull request #817:](https://github.com/junit-team/junit/pull/817) Support for context hierarchies
2429

2530
The `AnnotatedBuilder` is a strategy for constructing runners for test classes that have been annotated with the `@RunWith` annotation. All tests within such a class will be executed using the runner that was specified within the annotation.
2631

@@ -140,7 +145,7 @@ If a custom failure message is not provided, a default message is used.
140145
# Timeout for Tests
141146
*See also [Timeout for tests](https://github.com/junit-team/junit/wiki/Timeout-for-tests)*
142147

143-
### [Pull request #823:] (https://github.com/junit-team/junit/pull/823) Throw `TestFailedOnTimeoutException` instead of plain `Exception` on timeout
148+
### [Pull request #823:](https://github.com/junit-team/junit/pull/823) Throw `TestFailedOnTimeoutException` instead of plain `Exception` on timeout
144149

145150
When a test times out, a `org.junit.runners.model.TestTimedOutException` is now thrown instead of a plain `java.lang.Exception`.
146151

@@ -225,6 +230,8 @@ public class HasGlobalTimeout {
225230
```
226231
Each test is run in a new _daemon_ thread. If the specified timeout elapses before the test completes, its execution is interrupted via `Thread#interrupt()`. This happens in interruptable I/O (operations throwing `java.io.InterruptedIOException` and `java.nio.channels.ClosedByInterruptException`), locks (package `java.util.concurrent`) and methods in `java.lang.Object` and `java.lang.Thread` throwing `java.lang.InterruptedException`.
227232

233+
### [Pull request #876:](https://github.com/junit-team/junit/pull/876) The timeout rule never times out if you pass in a timeout of zero.
234+
228235

229236
# Parameterized Tests
230237

@@ -242,7 +249,7 @@ The factory for creating the `Runner` instance of a single set of parameters is
242249
# Rules
243250

244251

245-
### [Pull request #552:](https://github.com/junit-team/junit/pull/552) `Stopwatch` rule
252+
### [Pull request #552:](https://github.com/junit-team/junit/pull/552) [Pull request #937:](https://github.com/junit-team/junit/pull/937) `Stopwatch` rule
246253

247254
The `Stopwatch` Rule notifies one of its own protected methods of the time spent by a test. Override them to get the time in nanoseconds. For example, this class will keep logging the time spent by each passed, failed, skipped, and finished test:
248255

@@ -342,6 +349,31 @@ If you call `TemporaryFolder.newFolder("foo/bar")` in JUnit 4.10 the method retu
342349

343350
With this fix, folder names are validated to contain single path name. If the folder name consists of multiple path names, an exception is thrown stating that usage of multiple path components in a string containing folder name is disallowed.
344351

352+
### [Pull request #1015:](https://github.com/junit-team/junit/pull/1015) Methods annotated with `Rule` can return a `MethodRule`.
353+
354+
Methods annotated with `@Rule` can now return either a `TestRule` (or subclass) or a
355+
`MethodRule` (or subclass).
356+
357+
Prior to this change, all public methods annotated with `@Rule` were called, but the
358+
return value was ignored if it could not be assigned to a `TestRule`. After this change,
359+
the method is only called if the return type could be assigned to `TestRule` or
360+
`MethodRule`. For methods annotated with `@Rule` that return other values, see the notes
361+
for pull request #1020.
362+
363+
### [Pull request #1020:](https://github.com/junit-team/junit/pull/1020) Added validation that @ClassRule should only be implementation of TestRule.
364+
365+
Prior to this change, fields annotated with `@ClassRule` that did not have a type of `TestRule`
366+
(or a class that implements `TestRule`) were ignored. With this change, the test will fail
367+
with a validation error.
368+
369+
Prior to this change, methods annotated with `@ClassRule` that did specify a return type
370+
of `TestRule`(or a class that implements `TestRule`) were ignored. With this change, the test
371+
will fail with a validation error.
372+
373+
### [Pull request #1021:](https://github.com/junit-team/junit/pull/1021) JavaDoc of TemporaryFolder: folder not guaranteed to be deleted.
374+
375+
Adjusted JavaDoc of TemporaryFolder to reflect that temporary folders are not guaranteed to be
376+
deleted.
345377

346378
# Theories
347379

@@ -629,3 +661,52 @@ While using JUnit in Android apps, if any other referenced library has a file na
629661
`Error generating final archive: Found duplicate file for APK: LICENSE.txt`
630662

631663
To avoid this, the license file has been renamed to `LICENSE-junit.txt`
664+
665+
666+
### [Pull request #962:](https://github.com/junit-team/junit/pull/962) Do not include thread start time in test timeout measurements.
667+
668+
The time it takes to start a thread can be surprisingly large.
669+
Especially in virtualized cloud environments where noisy neighbours.
670+
This change reduces the probability of non-deterministic failures of
671+
tests with timeouts (@Test(timeout=…)) by not beginning the timeout
672+
clock until we have observed the starting of the task thread – the
673+
thread that runs the actual test. This should make tests with small
674+
timeout values more reliable in general, and especially in cloud CI
675+
environments.
676+
677+
# Fixes to issues introduced in JUnit 4.12
678+
679+
The following section lists fixes to problems introduced in the first
680+
release candidates for JUnit 4.12. You can ignore this section if you are
681+
trying to understand the changes between 4.11 and 4.12.
682+
683+
### [Pull request #961:](https://github.com/junit-team/junit/pull/961) Restore field names with f prefix.
684+
685+
In order to make the JUnit code more consistent with current coding practices, we changed
686+
a number of field names to not start with the prefix "f". Unfortunately, at least one IDE
687+
referenced a private field via reflection. This change reverts the field names for fields
688+
known to be read via reflection.
689+
690+
### [Pull request #988:](https://github.com/junit-team/junit/pull/988) Revert "Delete classes that are deprecated for six years."
691+
692+
In [745ca05](https://github.com/junit-team/junit/commit/745ca05dccf5cc907e43a58142bb8be97da2b78f)
693+
we removed classes that were deprecated for many releases. There was some concern that people
694+
might not expect classes to be removed in a 4.x release. Even though we are not aware of any
695+
problems from the deletion, we decided to add them back.
696+
697+
These classes may be removed in JUnit 5.0 or later.
698+
699+
### [Pull request #989:](https://github.com/junit-team/junit/pull/989) Add JUnitSystem.exit() back.
700+
701+
In [917a88f](https://github.com/junit-team/junit/commit/917a88fad06ce108a596a8fdb4607b1a2fbb3f3e)
702+
the exit() method in JUnit was removed. This caused problems for at least one user. Even
703+
though this class is in an internal package, we decided to add it back, and deprecated it.
704+
705+
This method may be removed in JUnit 5.0 or later.
706+
707+
### [Pull request #994:](https://github.com/junit-team/junit/pull/994) [Pull request #1000:](https://github.com/junit-team/junit/pull/1000) Ensure serialization compatibility where possible.
708+
709+
JUnit 4.12 RC1 introduced serilization incompatibilities with some of the classes. For example,
710+
these pre-release versions of JUnit could not read instances of `Result` that were serialized
711+
in JUnit 4.11 and earlier. These changes fix that problem.
712+

0 commit comments

Comments
 (0)