Skip to content

Releases: approvals/ApprovalTests.Java

Easy reordering of JSON for consistent approvals

12 Oct 21:13

Choose a tag to compare

The Problem:

JSON does not define an order to the fields.
This can make approving JSON inconsistent as ApprovalTests requires consistent results.

The Solution:

JsonApprovals.verifyJson(json) now has an overload:
JsonApprovals.verifyJson(json, reorderJson: true)
which will alphabetically sort the JSON in the result.
By default it still does not reorder the JSON.

Extras

You can call the reordering directly with
JsonUtils.reorderFields(json)
This fixes #422

Improvements for IntelliJ reporters when using Jetbrains Toolbox

09 Oct 17:55

Choose a tag to compare

On Mac, when using Jetbrains Toolbox, we now should detect your IntelliJ installation and launch the idea diff viewer.

Fixes to KDiff3

05 Oct 21:43

Choose a tag to compare

Added KDiff3 Linux reporter.
Minor breaking changes
KDiff3Reporter has been moved to KDiff3MacReporter, KDiff3WindowsReporter as appropriate.
We also created a generic KDiff3 reporter that will work on all three systems.
Closes issue #412

Removal of EnvironmentAwareReporter

02 Oct 17:55
cbf0b61

Choose a tag to compare

This is a breaking change.

When you call Reporter.report(received, approved) it now returns if it was successful.
This makes the java architecture more consistent with other implementations and allows us to determine when something should have worked but it didn't.

It should not affect you unless you've written a custom implementation of ApprovalFailureReporter.

Information on why and how to upgrade can be found here.

Exceptions and Help messages on duplicate verify() calls.

11 Sep 17:55

Choose a tag to compare

ApprovalTests only wants one call to verify() per test.
There are ways to go around this but if you call verify where it would want the exact same file name twice, it will now throw an exception.
This will make it easier for people to not be confused as most other testing frameworks allow you to put multiple assertions in the same test.

Backwards compatibility

There are some situations where you want to check that two different processes produce the same result.
Calling verify multiple times in the same test can be a way to do this.
If you want to do that, we have provided two calls:

  • Approvals.settings().allowMultipleVerifyCallsForThisClass()
  • Approvals.settings().allowMultipleVerifyCallsForThisMethod()

Fixed bugs with ArrayUtils.combine

11 Jul 00:27

Choose a tag to compare

Fixes:

  1. null passed as either first or second parameters
  2. Typing combine(child, parent) didn't work.
  3. ie. combine(1.0, 2, 3) will now work.

Queryable.selectRecursivelyUntil

03 Jul 19:17
555045b

Choose a tag to compare

Also, minor IntelliJReporter fixes, handling null better.

DiffMergeReporter

26 Jun 17:51

Choose a tag to compare

Added a class DiffMergeReporter that wraps both linux and macos reporters.

NormalizeSpacesScrubber

03 Apr 17:49

Choose a tag to compare

With this scrubber you can avoid test failures in the case that whitespace character was changed to another unicode character when displaying dates, for example https://bugs.openjdk.org/browse/JDK-8274768

This will display as

- | getTime("AM/PM")        | 12:00 AM | 
+ | getTime("AM/PM")        | 12:00 AM |

Custom Comparator

13 Oct 15:21

Choose a tag to compare

  • DateScrubber.getScrubberFor() now accepts http date header format
  • XStream dependency is now optional as it should be
  • Options now has a comparator if you wish to create a custom comparator #301