Releases: mkutz/ApproveJ
Release v1.0
Changelog
core
-
🧹 all deprecated methods have been removed
-
🪨 a lot of implementations are now in the form of immutable record classes
-
🪲 approving by file is now also possible in parameterized tests
Big thanks to @blazmrak for reporting #158 -
📖 minor updates in the manual
Full Changelog: v0.12.1...v1.0
Release v1.0-RC1
Changelog
core
- 🏗️ several classes (e.g. built-in
ScrubberandReplacementimplementations) were transformed into interfaces with record implementations - 🏗️ the
ScrubberandReplacementinterfaces are now more generic ⚠️ all previously deprecated methods and classes were removed
manual
- 📖 the usage PrintFormat is now properly documented in the manual
- 📖 some errors in JavaDoc were fixed
Release v0.12.1
Changelog
-
🪲 Fix double approval when printing happens implicitly in
bymethod
When callingby,byValue, orbyFilewithout previous printing theApprovalPrintershould apply the configureddefaultPrinterbefore approval.
In the previous release this actually happened, but the approval was performed twice: once on the unprinted value and once on the printed, which leads to unnecessary and potentially error causing overwriting and renaming of received and approved files. -
🐞 Re-add
PathProviderBuilderwith its initializers
The initializer methods were moved fromPathProviderBuilderto the newPathProviderrecord class, which breaks imports.
The class was re-added (and marked deprecated).
Full Changelog: v0.12...v0.12.1
Release v0.12
Migration Guide
-
In your
src/test/resources/approvej.propertiesor~/.config/approvej/approvej.propertiesreplace the property keydefaultPrinterwithdefaultPrintFormatand its value with one of the newPrintFormatimplementations:org.approvej.print.ToStringPrinter
→org.approvej.print.SingleLineStringPrintFormatorg.approvej.print.ObjectPrinter
→org.approvej.print.MultiLineStringPrintFormatorg.approvej.json.jackson.JsonPrettyPrinterororg.approvej.json.jackson.JsonStringPrettyPrinter
→org.approvej.json.jackson.JsonPrintFormatorg.approvej.yaml.jackson.YamlPrinter
→org.approvej.yaml.jackson.YamlPrintFormat
-
Replace
ApprovalBuilder.print*method calls with new versionsprint()
→printed()printWith(Function)
→printedBy(Function)printWith(ObjectPrinter.objectPrinter())orprintWith(MultiLineStringFormat.multiLineString())
→printedAs(MultiLineStringFormat.multiLineString())printWith(JsonPrettyPrinter.jsonPrettyPrinter())orprintWith(JsonStringPrettyPrinter.jsonStringPrettyPrinter())
→printedAs(JsonPrintFormat.json())printWith(YamlPrinter.yamlPrinter())
→printedAs(YamlPrintFormat.yaml())
-
Replace
ApprovalBuilder.reviewWithwithApprovalBuilder.reviewedWith -
Initialize
PathProviders(forApprovalBuilder.byFile(PathProvider)) with new initializer fromPathProviders
e.g.import static org.approvej.approve.PathProviderBuilder.approvedPath
→import static org.approvej.approve.PathProviders.approvedPath -
(Optionally) replace
Replacements.string("[mystring]")withReplacements.labeled("mystring")
Changelog
core
-
🔌 new
ApprovalBuilderAPI
Generally all modifying methods are now in passive voice:print→printedprintWIth→printedBy/printedAsreviewWith→reviewedBy
-
🖨️ new
PrintFormat
The newPrintFormatall but replaces the oldPrinter, which is now a mere property of thePrinterFormatas well as thefilenameExtensionproperty.
ThePrinterwill remain a marker interface for aFunction<T, String>. -
🎛️ new configuration property
defaultPrintFormat
⚠️ The new property replacesdefaultPrinter, which should no longer be used. -
📅/🕔 new
RelativeDateTimeReplacement
The new replacement replaces parsed date/time strings with a (rounded) duration string.
Examples: "1d 23h 59m 59s ago", "in 20m 12s"
The rounding can be changed to any duration. By default the value is rounded to whole seconds. -
📅 changed
RelativeDateReplacement
The replacement strings are now prefixed with "in" for future dates (used to be "x days from now", and postfixed with "ago" for past dates (used to be "x days ago").
It also prints the duration in years, months and days, instead of only days.
Examples: "in 2 years", "3 months and 1 day ago"
The special cases "today", "yesterday" and "tomorrow" remain unchanged. -
🏷️ new
labeledReplacement
The new replacement takes a string label and simply replaces with[label]. -
🔒 Immutability
Most classes in core (and other modules) are now immutable.
Their API may not have been changes by that, as modifying methods now simply return a copy of the object with the desired change. -
🧭 new
PathProvider
The new record class gives more fine-grained information on the path elements and allows more configurations.
Initializers for it can now be found in the classPathProviders.
yaml-jackson, json-jackson
Both modules now offer PrintFormat implementations, which should be used instead of the old Printer implementations.
Full Changelog: v0.11.2...v0.12
Release v0.11.2
Changelog
core
-
🧽 New
FieldScrubberThe new scrubber can be used to scrub a field on an object.
It relies on reflection to make the field in question visible and writable.
Hence it has its limits, e.g. it won't work on Java records.approve(new Article("Bubblegum")) // the constructor generates a String id .scrubbedOf(field(Article.class, "id").replacement("1")) // the FieldScrubber replaces the value .byFile();
-
💥 New
ScrubbingError
This new exception became necessary in theFieldScrubberin case the field could not be accessed via reflection.
It can also be used in your customScrubberimplementations.
Release v0.11.1
Changelog
core
- 📄 The FileApprover now cleans up old approved files
When changing the printer, the filename extension changes (e.g. formtxttojsonand the old files need to be removed manually.
In such cases the previously approved text is also lost.
Now the FileApprover looks for files that have the right name, but not the right extension.
If there's no approved file with the right extension, the most recently modified of these files is renamed with the new extension.
All older files are being deleted. ‼️ New error message if no approved file was found
Until now an empty approved file was handled as an approved file.
Now if the approved file didn't exist (or is empty) the error message says that the result was unapproved, instead of an approval mismatch.
Full Changelog: v0.11...v0.11.1
Release v0.11
Changelog
core
-
🪲 Approvals in Awaitility lambdas now works as expected
Prior this fix, finding the path to the test file failed due to the fact that lambdas change the method name in the current thread's stacktrace.
E.g.lambda$myTestMethod$4instead ofmyTestMethod.
See #98. -
🖨️ The ObjectPrinter now also prints fields of super-classes
-
🖨️ BREAKING CHANGE The Object printer now prints all fields in the order of their declaration
Prior the fields were always sorted alphabetically by name.
If you prefer the sorted output, you can simply call thesortedmethod. E.g.:approve(object) .printedWith(objectPrinter() .sorted()) // keeps the sorted output .byFile()
Full Changelog: v0.10.1...v0.11
Release v0.10.1
Changelog
core
- 🪲 Fix printing empty collections
The ObjectPrinter now prints empty collections as[].
json-jackson/yaml-jackson
- 📦 Bump jacksonVersion from 2.19.2 to 2.20.0
Full Changelog: v0.10...v0.10.1
Release v0.10
Changelog
core
- 🖨️ revamps the ObjectPrinter to also work well for Kotlin data classes
The new implementation uses fields to identify properties, but still calls getters to retrieve their values.
This prevents printing ofcomponentmethods in Kotlin data classes and makes the printing in general more robust. - 🎛️ adds new global configuration file
~/.config/approvej/approvej.properties
This allows to configure your personal favoritedefaultFileReviewerScript.
Full Changelog: v0.9.7...v0.10
Release v0.9.7
Changelog
core
- 🧽 adds strings scrubber
Scrubbers.strings(…)scrubs all given strings from the received value. Particularly useful for dynamic values created by the test code. - 🧽 adds new masking replacement
Replacements.masking()will replace strings likeZ-321-ABCwithA-111-AAA - 🐞 fixes order of expected and actual values in ApprovalError
- 📓 improves documentation
Full Changelog: v0.9.6...v0.9.7