Releases: assertj/assertj
v4.0.0-M1
🧩 Binary Compatibility
This release is binary incompatible with the previous major version.
💥 Breaking Changes
- Raise required Java version to 17 #3447
🚫 Deprecated
- Set
since = "3"
andforRemoval = true
for all deprecations #3762
Core
- Deprecate
@VisibleForTesting
for removal #3755
⚡ Improvements
- Run OpenRewrite Java 17 recipe #3759
- Add missing module descriptor to
assertj-guava
, adopt module-only build #3771 - Centralize
maven-enforcer-plugin
execution, append configurations
Core
- Replace
isSealed
reflection-based implementation with JDK built-in implementation #3081 - Replace
isRecord
reflection-based implementation with JDK built-in implementation #3079 - Add missing
java.sql
module dependency - Fix typo in
TemporalUnitLessThanOffset
Javadoc #3783 - Move script testing to separate module, improve test portability #3785
- Abort tests when symbolic links cannot be created #3788
🔨 Dependency Upgrades
Core
❤️ Contributors
Thanks to all the contributors who worked on this release:
@aalmiray @RaphaelJenni @SimonHarte @etrandafir93 @fml2 @Bananeweizen @lobaorn @sormuras
v3.27.3
💥 Breaking Changes
Core
-
Revert "Propagate common basetype for the extracting method" #3737
Details
The enhancement introduced with #3673 breaks existing code on Kotlin 1.9; therefore, it has been reverted.
As Spring Boot 3.4 currently supports Kotlin 1.9, we want to keep the same compatibility on AssertJ 3.x, while AssertJ 4.x will require Kotlin 2.x.
Existing code relying on the changes introduced with #3673 will no longer compile and should be refactored.
🐛 Bug Fixes
Core
- Fix
StandardRepresentation
regression for unquoted strings #3735
⚡ Improvements
Core
- Add
Class
info to class loading strategy failures #3746
❤️ Contributors
Thanks to all the contributors who worked on this release:
v3.27.2
v3.27.1
🚫 Deprecated
Core
- Deprecate
usingComparatorForFields
and remove deprecated assertions fromusingComparatorForType
documentation #3711 - Deprecate
hasCauseReference(Throwable)
fromThrowable
assertions #3715
🐛 Bug Fixes
Core
- Fix missing introspection for record accessors #3710
- Honor assertion description in
asString()
- Avoid
InputStream
manipulation whenmark
/reset
are supported #3713 - NPE with custom
RecursiveComparisonConfiguration
onusingRecursiveFieldByFieldElementComparator
#3719
⚡ Improvements
- Declare license using SPDX identifier #3718
❤️ Contributors
Thanks to all the contributors who worked on this release:
v3.27.0
💥 Breaking Changes
Core
-
Propagate common basetype for
extracting(Function...)
#3673Details
Before this change,
extracting(Function...)
changedactual
to a list ofObject
instances, even in cases where the resulting objects could have had a more specific common supertype. With this change, the element type of the returned list is narrowed down to the common supertype of the resulting elements, allowing the compiler to accept chained assertions specific to the common supertype.However, this can break existing code, like in #3709. Such cases do not justify reverting the change. Therefore, the affected code should be refactored accordingly, given that
contains
for list assertions already follows the same semantic.In addition, this can break existing code based on Kotlin 1.9, like in #3728. In such cases, either upgrade Kotlin to 2.x or upgrade AssertJ to 3.27.3, which restores compatibility with Kotlin 1.9.
🚫 Deprecated
Core
- Deprecate
ClassBasedNavigableIterableAssert
andClassBasedNavigableListAssert
#3529
✨ New Features
Core
- Add
actual()
to access the object under test #3489 - Add
isCompletedWithValueMatchingWithin
toCompletableFuture
assertions #3506 - Add
completesExceptionallyWithin
toCompletableFuture
assertions #3597 - Add
inBinary
toCharSequence
assertions #3600 - Support for
Assertions.byLessThan(Duration)
andAssertions.within(Duration)
#3486 - Add standard representation for
CharSequence
#3617 - Add predicate descriptions overloads to
anyMatch
andnoneMatch
#3639 - Add
doesNotMatch(Predicate)
#3684 - Add
usingEquals
accepting aBiPredicate
and an optional description to provide a custom comparison in assertions #3678
Guava
- Add
isNotEmpty
toTable
assertions #3559
🐛 Bug Fixes
Core
- Recursive assertion
hasNoNullFields
throws NPE with fields of anonymous and local types #3534 - Fix incorrect mutation of
actualElementsGroupedByHashCode
in recursive comparison - Recursive comparison
ignoringFields
not working properly with maps #2988 - Custom representation ignored when describing expected items not in the actual list #3646
hasFieldOrPropertyWithValue
swallows exceptions thrown by getters, and reports non-existent property instead #3563satisfies()
with nested assertions obscures stack trace #2542- Recursive comparison fails if ignored fields are not found in
expected
#3226
⚡ Improvements
Core
- Report all failing conditions when using
satisfies(allOf(Condition...))
#3537 - Fix Unicode escapes in
inUnicode()
Javadoc - Show error differences if values were compared with
equals
in recursive comparison #3209 - Add throwable stacktrace to
ShouldNotContainCharSequence
- Remove unused code and other minor cleanup #3683
- Simplify comparison strategy
isLessThan
andisLessThanOrEqualTo
inAbstractComparisonStrategy
#3694 - Update
AbstractCharSequenceAssert.java
reference #3700 - Include stack trace of internal errors in all/any satisfy assertions
🔨 Dependency Upgrades
Core
Guava
- Upgrade to Guava 33.4.0-jre #3705
❤️ Contributors
Thanks to all the contributors who worked on this release:
@JunHyungJang @mipo256 @vladykin @Marcono1234 @sunaleed @etrandafir93 @FlorianCousin @OlivierCavadenti @jh-instant @patrickuhlmann @IvoHD @alexandra-junghans @fmbenhassine @etrandafir93 @shaikhu @cookieMr @emmanuel-ferdman @mk868
v3.26.3
🧩 Binary Compatibility
The release is:
- Binary compatible with the previous minor version.
- Binary incompatible with the previous patch version.
💥 Breaking Changes
Core
- Replace
assertThat(Temporal)
withassertThatTemporal(Temporal)
#3519
🐛 Bug Fixes
Core
- Fix Javadoc rendering on
FactoryBasedNavigableListAssert::assertThat
- Allow
ComparingNormalizedFields
instances to be reused across different assertions #3493
🔨 Dependency Upgrades
Core
Guava
- Upgrade to Guava 33.2.1-jre #3499
❤️ Contributors
Thanks to all the contributors who worked on this release:
v3.26.0
💥 Breaking Changes
Core
-
Delegate
OptionalDouble
value comparison toDouble.compare
inhasValue
assertion #3411Details
This fixes the comparison of
NaN
values which wasn't working the way thehasValue
Javadoc describes.The previous behavior can be obtained with
getAsDouble
:assertThat(OptionalDouble.of(Double.NaN).getAsDouble()).isSameAs(Double.NaN);
🚫 Deprecated
Core
- Deprecate
ObjectAssertFactory
in favor ofAssertions.assertThat(Object)
- Deprecate
AssertionErrorFactory
in favor ofAssertionErrorCreator
- Deprecate
catchThrowableOfType(ThrowingCallable, Class)
in favor ofcatchThrowableOfType(Class, ThrowingCallable)
#2823 - Deprecate
assertThat(Iterable, AssertFactory)
,assertThat(Iterable, Class)
and their respectivethen
variants #3453
✨ New Features
Core
- Support multiple
AfterAssertionErrorCollected
callbacks #3313 - Add
InstanceOfAssertFactory
forSet
instances #3325 - Add
doesNotContainKey
anddoesNotContainKeys
to GuavaMultimap
assertions #3334 - Add assertions for JDK
YearMonth
type #3142 - Add
TemporalAssert
type #3404 - Add
ignoringFieldsOfTypesMatchingRegexes
#3369 - Add
fail(Throwable)
andfail()
variants #3204 - Add
isPrivate
toClass
assertions - Add
doesNot[Start/End]WithWhitespace
methods toCharSequence
assertions #3441 - Add
createAssert(ValueProvider)
toAssertFactory
#3377 - Add
values()
navigation method toAbstractMapAssert
#3297 - Add
bytes()
/bytes(Charset)
/bytes(String)
navigation methods toAbstractStringAssert
#3232 - Add
doesNotThrowAnyExceptionExcept
toAbstractThrowableAssert
#3261 - Add
hasPermittedSubclasses
toClass
assertions #3316 - Add
isUnmodifiable
toIterator
assertions #3477
🐛 Bug Fixes
Core
- Preserve original order of elements when returning duplicates on
doesNotHaveDuplicates
#3333 - Make
isNotEqualTo(boolean)
pass whenactual
isnull
#3343 - Fix
isEqualTo
comparison ofTimestamp
instances withInstant
#3410 - Fix
Instant
conversion withDate
assertions #3467 - Rebuild default date formats used to parse strings as dates when default timezone or lenient flag changes #3382
⚡ Improvements
- Avoid duplicating
maven-javadoc-plugin
configuration and CSS files #3371 - Favor
additionalOption
entries inmaven-javadoc-plugin
Core
- Fix typo in Javadoc #3365
- Improve
AssertFactory
Javadoc - Add
Throwable
stack trace toShouldHaveCauseExactlyInstance
#3351 - Fix typo #3422
- Add
Throwable
stack trace toShouldHaveCauseInstance
#3392 - Implement boolean assertions directly in
AbstractBooleanAssert
and removeBooleans
internal class - Remove stack trace elements triggered by AssertJ in addition to AssertJ elements #3449
🔨 Dependency Upgrades
Core
Guava
- Upgrade to Guava 33.2.0-jre #3454
❤️ Contributors
Thanks to all the contributors who worked on this release:
@Achitheus @csct3434 @armandino @sbrannen @shaikhu @ryber @ranjitshinde91 @tmvlpl @valery1707 @izeye @yyytir777 @pbacz @biergit @Banuelorigni @java-coding-prodigy @vlsi @hazendaz @Kruschenstein @etrandafir93 @pbacz @dehasi
v3.25.3
🐛 Bug Fixes
- Lock
maven-clean-plugin
version for all modules
Core
- Fix a performance regression in the recursive comparison related to
FieldLocation
#3350 - Don't fail when the recursive comparison checks compared fields in collection elements #3349 (proper fix: #3354)
❤️ Contributors
Thanks to all the contributors who worked on this release:
v3.25.2
🐛 Bug Fixes
- Fix unresolvable Javadoc stylesheet URLs, simplify configuration #3324
Core
- Fix missing configuration for
MatcherAssert
soft assertions - Make deprecation notice visible in
AbstractAssert#asList
#3327 - Recursive comparison uses
equals
on root object whenuseOverriddenEquals
is enabled #3320 satisfiesExactlyInAnyOrder
fails ifactual
overridesequals
#3339- Avoid calling
actual.hashCode()
andexpected.hashCode()
inDualValue
#3340 - Recursive comparison checks for existence of fields in types that parameterize nested unordered iterables #3332
❤️ Contributors
Thanks to all the contributors who worked on this release:
v3.25.1
🧩 Binary Compatibility
The release is:
- Binary compatible with the previous minor version.
- Binary incompatible with the previous patch version.