Releases: assertk-org/assertk
Releases · assertk-org/assertk
0.28.1
v0.28.0
[0.28.0] 2023-12-05
Changed
- Minimum supported kotlin version is 1.9.21
- Rename
isSameAs/isNotSameAstoisSameInstanceAs/isNotSameInstanceAsto make it more clear they
use are about instance identity, old name is deprecated - Rename
containsAlltocontainsAtLeastto make it more clear that the collection can contain additional elements,
old name is deprecated - Bytes are shown as hex on all supported platforms (previously it was only on the jvm)
- If
isEqualTofails and the expected and actual display the same string, print a disambiguation message, ex:expected:<4> with type:<class kotlin.Int> but was type:<class kotlin.Short> with the same string representation
Breaking Changes
- Binary-breaking change as previous error-level deprecations were removed
Added
- Added
doesNotContainKeyassertion forMap
Fixed
- Fixed incorrect usage of contains in some kdoc examples
- Exceptions being swallowed if thrown in a soft assertion block
- More correctly re-throw fatal error in the jvm
v0.27.0
[0.27.0] 2023-09-13
Changed
- Minimum supported kotlin version is 1.9.0
- Added support for WASM targets (note: this only applies to the core library
and not assertk-coroutines as the coroutines library doesn't have a stable
release for it yet)
Breaking Changes
- Previous
assertThat {}deprecation warning is now an error
v0.26.1
v0.26
[0.26] 2023-05-12
Changed
- Minimum supported kotlin version is 1.8.10
- Minimum supported coroutines version is 1.7.0
- When asserting on a
Throwableor failedResult, their exception is added as the cause to any
AssertionErrors which are thrown as the result of an assertion failure. - Removed second type parameter on
Any.isInstanceOfextension. In practice this would generally widen
toAnywhich is what it has been replaced with.
Breaking Changes
- Previous deprecations are now errors
Added
- Added
assertFailure { }entrypoint which is a shorthand forassertThat(runCatching { .. }).isFailure() - Added
firstandsingleassertion forIterable - Added
containsMatchassertion forCharSequence.
Unlike 'contains' this is a regex rather than a literal.
Unlike 'matches' this looks for a subset of theCharSequenceto match rather than the entire contents. - Added reified overloads of
hasClass,doesNotHaveClass,isInstanceOf, andisNotInstanceOf.
For example:isInstanceOf<String>(). - Added sequence assertions to mirror iterable
- Added array assertions for
UByteArray,UShortArray,UIntArray, andULongArray.
Deprecated
- Lambda-accepting
assertThat { }entrypoint is now deprecated.
UseassertThat(T)for normal values orassertFailure { }for exception-throwing code.
Fixed
- Fixed iterable assertions that take a block that could have multiple assertions.
Includes:none,atLeast,atMost,exactly, andany
v0.25
[0.25] 2021-09-12
Changed
- Minimum supported kotlin version is 1.5.30
- Minimum supported coroutines version is 1.5.2
- Replaced custom result type returned from
assertThat {}withkotlin.Result. This is a binary-incompatible change,
but it should be source-compatible in most cases as referencing the custom result type directly was discouraged.
Added
- Added
startsWith()andendsWith()forList. - Added
Optional<>.isPresent(),Optional<>.isEmpty(),Optional<>.hasValue() - Added expanded set of apple targets for kotlin native.
Fixed
- Fixed behavior of
isEqualToIgnoringGivenPropertiesto only check accessible properties. - Added
propwhich can take a member function. This restores much of the functionality deprecated
in 0.23, while preserving the useful type-safety of the new overloads.
v0.24
v0.23.1
[0.23.1] 2021-02-03
Fixed
- Fixed
containsExactlyfailing on custom list types. - Fixed NullPointerException in
isDataClassEqualTowhen a property is null. - Fixed multiple failures breaking
any - Fixed map's
containsOnlyto ensure keys match up with values. - Fixed map's contain methods null handling.
v0.23
Changed
- Minimum supported kotlin version is 1.4.0
- Multiplatform artifacts are published as a single artifact. You can now just write
sourceSets { commonTest { dependencies { implementation "com.willowtreeapps.assertk:assertk:..." } } }
instead of defining one for each platform.
- Added support for the Kotlin/JS IR compiler
- Added optional
displayActualfunction toassertThatas an alternative to.toString()for external types - Moved most
Stringassertions toCharSequence
Added
- Added
propfunction withKProperty1argument. - Added
containsExactlyInAnyOrderassertion forIterableand primitive arrays - Added initial Coroutines artifact (additional support planned for the future)
Deprecated
- Deprecated
propfunction withKCallableargument. Use the new overload
with type-safeKProperty1argument or another overload with explicit name and lambda.
Fixed
- Primitive array 'contains' methods now work with NaN. ex:
will pass when it failed before.
assertThat(floatArrayOf(Float.Nan)).contains(Float.NaN)
- Fixes a bug causing failures to sometimes be dropped in a nested assertion context
v0.22
Added
- Add multi-value support for
Assert<String>.contains()anddoesNotContain() - Add
isEqualByComparingToto compare objects bycompareToinstead ofequalsthis is useful for cases like
BigDecimalwhereequalswould fail because of differing precision. - Add
containsOnlyfor arrays.
Changed
- Minimum supported kotlin version is 1.3.70
- Updated opentest4j to 1.2.0. This changes the multiple assertion message to include each exception class name.
- Moved
containsAll,containsNone, andcontainsOnlyfromCollectiontoIterableto make
them a bit more flexible. containsAll,containsNone, andcontainsOnlyerror messages now include the expected and actual lists.- Unwrap exceptions thrown by
prop(callable: KCallable<*>)to make them more clear. - Add all exception stacktraces to a
MultipleFailuresErrorwithThrowable.addSurpressedon the jvm (used when
collecting multiple exceptions withassertAll). Unfortunately, if you are using gradle you won't see this due to a
known gradle issue. - No longer wrap exceptions in
AssertionErrors when usinggivenandtransform. Warning: this is techinicaly a
breaking change as code like:will no longer be caught. But you shouldn't be writing code like that anyway ;)try { assertThat(foo).given { throw MyException("error") } } catch (e: AssertionError) { // assume caught }
Fixed
- Don't let
assertAllcaptureOutOfMemoryerrors.
Breaking Changes
- Previously deprecated methods (as of 0.18) are now errors.