All Versions
10
Latest Version
Avg Release Cycle
58 days
Latest Release
55 days ago

Changelog History

  • v0.9.0-alpha

    August 29, 2019

    This is a pre-release for early adopters using currently cc.en_GB and want to switch to fluent.en_GB which makes use of Expect instead of Assert

    Following the setup instructions:

    dependencies {
        testImplementation "ch.tutteli.atrium:atrium-fluent-en_GB:0.9.0-alpha"
    }
    

    🚀 Proper release notes will follow with the final release of 0.9.0, following already the migration guide

    🗄 Migrating deprecated functionality

    🚀 In case you migrate from a version < 0.7.0 then please have a look at the migration guide given in the Release Notes of 0.7.0.
    Otherwise you can use the suggested replacements (ALT + Enter -> Replace with ...) or the search/replace patterns shown below.

    🔔 Notice, that you don't have to migrate everything at once where asExpect and asAssert allow to switch between the old Assert and the new Expect world.
    Ping us in the Atrium slack channel if you need help.

    Following a few hints how you can migrate faster by using a few regex search replace commands (make sure you have checked Regex in the search) -- it might be the search replace is not enough for your use case and require a few adjustements from your part) :

    Switch all your assertion functions to use Expect and no longer Assert:

    Search: import ch.tutteli.atrium.creating.Assert(ionPlant(Nullable)?)?
    Replace: import ch.tutteli.atrium.creating.Expect

    Repeat until you don't have duplicate imports anymore
    Search: import ch.tutteli.atrium.creating.Expect\n\s*ch.tutteli.atrium.creating.Expect
    Replace: import ch.tutteli.atrium.creating.Expect

    Search: Assert(ionPlant(Nullable)?)?<
    Replace: Expect<

    Switch to ExpectImpl.changeSubject instead of using AssertImpl.changeSubject:
    Search: AssertImpl([\n\r\s]).changeSubject(([)\n]+))[\n\r\s]{[\n\r\s]*subject
    Replace: ExpectImpl$1.changeSubject$1.unreported($2) { it

    Search: AssertImpl([\n\r\s]*).changeSubject(([)]+))
    Replace: ExpectImpl$1changeSubject.unreported($1)

    🏗 builder.descriptive, safe withTest

    🏗 Search: AssertImpl([\n\r\s]).builder([\n\r\s]).createDescriptive(([,\n]+,[)]+)[\n\r\s]{[\n\r\s])plant.subject
    🏗 Replace: AssertImpl$1.builder$2.createDescriptive(plant, $3it

    🏗 Search: AssertImpl([\n\r\s]).builder([\n\r\s]).descriptive([\n\r\s]).withTest((?[\n\r\s]){([\n\r\s]*)plant.subject
    🏗 Replace: AssertImpl$1.builder$2.descriptive$3.withTest(plant)$4{$5it

    🏗 Search: AssertImpl([\n\r\s]).builder([\n\r\s]).descriptive([\n\r\s]).withTest((?[\n\r\s]){([\n\r\s]*)subject
    🏗 Replace: AssertImpl$1.builder$2.descriptive$3.withTest(this)$4{$5it

    👉 use new feature mechanism

    This one needs extra care as arguments could be function calls. Verify the replacements

    Search: (?:property|returnValueOf|rueckgabewertVon)(subject::([)]+)).
    Replace: feature { f(it::$1) }.

    Search: (?:property|returnValueOf|rueckgabewertVon)(subject::([)]+))(\s*{)
    Replace: feature({ f(it::$1) })$2$

    Search: (?:property|returnValueOf|rueckgabewertVon)(([:]+)::([)]+))
    Replace: feature($1::$2)

    toThrow with empty assertionCreator lambda
    Search: .((?:toThrow|wirft|isA|istEin)<[>]+>)\s*{\s*}
    Replace .$1()

    migrate custom assertion verbs
    ♻️ Switch from AssertImpl.coreFactory.newReportingPlant to ExpectImpl.assertionVerbBuilder
    👀 see atriumVerbs.kt for an example

  • v0.8.0

    April 28, 2019

    Jar's can be found here: https://bintray.com/robstoll/tutteli-jars/atrium/0.8.0
    API Maturity : Stable
    Implementation Maturity : Almost Stable

    🚀 There won't be any breaking changes in the API (assertion functions/builders) until v1.0.0 besides parameter name renaming. But we want to progress as well and deprecate functionality in each version (e.g quite a lot with 0.7.0; please replace deprecated functionality until v1.0.0 where we will remove it.
    ✅ However, we do not provide yet a stable API for the domain and core modules of Atrium -- it is almost stable, but there might be slight breaking changes which we want to introduce before v1.0.0. That is also the reason why we do not have yet established backward compatibility tests for domain/core. This might affect you if you write your own assertion functions. And it also affects you if you provide your own implementation for parts of Atrium.

    Table of Content

    • 🆕 New Features
      • API
      • Domain/Core aka write own assertion functions
      • Others
    • 🛠 Fixes
    • Improvments
    • 💥 Breaking Changes
    • 🗄 Deprecation
    • 🗄 Migrating deprecated functionality

    🆕 New Features

    API

    • #27 containsExactly as replacement for containsStrictly, thanks to @msmoljan for the implementation and thanks to @christophsturm for the idea
    • #33 isNotBlank for CharSequence, thanks to @pt2121 for the implementation
    • #39 make atLeast optional for CharSequence.contains, thanks to @christophsturm for the idea
    • #51 keys and values for Map to postulate assertions about the keys or values of a Map
    • #37 asEntries for Map, thanks to @arjank for the implementation
    • #29/#75 getExisting for Map to postulate assertions about the value of a corresponding key
    • #28 containskey, #59 containsNotKey for Map, thanks to @uaArsen for the implementation
    • #61/#62 contains for Map
    • #30/#76 get for List
    • #53 notToThrow as counterpart of toThrow - thanks to @charleskorn for the idea
    • #65 shortcut property/fun for Pair.first and Pair.second
    • #25 isKeyValue as well as shortcut property/fun key/value for Map.Entry
    • #69 toBe was opened up for nullable subjects (accepts now Any?), thanks to @dave08 for the discussion
    • #70 toBeNullIfNullElse for nullable subjects, thanks to @dave08 for the idea
    • #71 shortcut property/fun Collection.size
    • #78 containsExactly with single assertion creator
    • #48 asIterable with assertionCreator block
    • #46 o as alternative to this in sub-assertions for the infix API

    Domain / Core

    🔋 Features for assertion-function-writers:

    • #67 AssertImpl.mapArguments -> to map a variable length argument lists of the form first: T, vararg rest: T (inside a function T, Array<out T>) to R, Array<out R>
    • #72 changeSubject to a nullable type
    • AssertImpl.feature.extractor -> in case you want to make an assertion about a feature which is not always safe to extract (e.g. List.get expects a suitable index)
    • ✨ AssertImpl.collector.collectOrExplain => collects assertions for later usage but only if it is safe to collect them, otherwise it wraps them into an explanatory assertion so that it can be used to enhance reporting
    • AssertImpl.collector.collectNullable which allows to collect assertions for a nullable subject (for AssertionPlantNullable instead of AssertionPlant)

    Others

    • turned Atrium into an multi-platform project; all dependencies are also available for:
      • the JS platform => use the -js suffix; you will have to migrate to bundle en_GB if you still use en_UK, see Migrating deprecated functionality below.
      • the Android platform => use the -android suffix => Thansk to @ultraon for reporting #52 regarding issues with module-info.class
    • 🗄 #41 deprecated notToBeNullBut for BigDecimal
    • 🗄 #55 infix API - deprecated calls to toBe if a keyword is passed inadvertently
    • ✅ stacktraces in error reporting should no longer contain stack frames of Atrium or test runners

    🛠 Fixes

    • none this time

    👌 Improvements

    • DetailedObjectFormatter shows now Kotlin types instead of Java types (e.g. kotlin.Int instead of java.lang.Integer).
    • an AtriumError is now thrown instead of an AssertionError (AtriumError is a subtype of AssertionError)

    💥 Breaking Changes

    Planned (previously deprecated or announced)

    • none this time

    Unplaned

    • Made Group, GroupWithoutNullableEntries and GroupWithNullableEntries invariant. I doubt this will be a problem for someone, otherwise let me know
    • Made Value, Values, Entry, Entries invariant; in case you get problems, try to use user-site variance and specify out there
      The following breaking changes only bother you if you implemented an own core. Most have been necessary to turn Atrium into a multi-platform project:
    • core uses now an own implementation of Locale and no longer java.util.Locale
    • core uses now KClass instead of Class
    • TranslatableWithArgs takes a List instead of an Array as parameter
    • Reporter needs to provide an AtriumErrorAdjuster in addition
    • ✂ removed duplicate anyAssertions in package ch.tutteli.atrium.domain.creating.any.typetransformation.creators (use the one from package ch.tutteli.atrium.domain.creating)

    tl;dr the following is only of interest if you rely on binary compatibility
    I changed the JvmName of contains? in cc-en_UK and cc-infix-en_UK to containsDeprecated and enthaelt? in cc-de_CH to enthaeltDeprecated due to the DEX compiler for android which cannot handle ? in identifiers. This is a binary backward compatibility break for a method which I introduced in 0.7.0 to retain source backward compatibility. In case you use still use cc-en_UK or cc-infix-en_UK and rely on binary compatibility you will have to recompile when updating to 0.8.0.

    🗄 Deprecation

    🚚 The following was deprecated and will be removed with 1.0.0:

    • Assert<Iterable>.containsStrictly use containsExactly instead.
    • 🌐 ReporterBuilder::withoutTranslations using java.util.Locale => use Atrium's Locale
    • 0️⃣ TranslatorOption::withDefaultTranslator using java.util.Locale => use Atrium's Locale
    • 0️⃣ TextAssertionFormatterOption::withDefaultTextCapabilities => use withTextCapabilities which uses KClass instead of Class
    • 🔧 AtriumErrorAdjusterOption::withOnlyFailureReporter and withCustomReporter => new step in configuration, use either withDefaultAtriumErrorAdjusters or choose one of the other options
    • 👀 all functions containing nullable in their name => their counterpart without nullable in their name where opened up to accept also nullable types (see #60 for details)

    Possible Breaking Changes with 0.9.0

    • I will prepare the transition to Assert<T> instead of Assert<out T>. I will turn Assert into an own type (currently only a type alias) - you should not notice something but it means that the binary code will change when you compile against 0.9.0
    • ✅ I might reuse opentest4j exceptions to improve error reporting in IDEs. For this to work I might have to make modifications to Assertion/AssertionGroup (would only affect core implementors).
    • 👻 An exception will be thrown where one has to define an assertionCreator -- shall prevent kind of dead code/incomplete assertions; for instance assert(mapOf("a" to 1)).keys {}
      • same for addAssertionsCreatedBy/and {}; they will throw an exception if no sub-assertion is defined
    • toBe, contains etc. which expect T where <T: Any> might be restricted to input types, so that comparing apple with oranges is no longer possible without explicitly stating the type. E.g. assert(1).toBe("hello")would be a compile error

    Possible Breaking Changes with 1.0.0

    Please open an issue if you are not happy with one of the changes and state why or contact me via the Atrium slack channel.

    Assert<Throwable>.message{} will return Assert<Throwable> instead of Unit

    Assert<T>.isA{} will return Assert<T> instead of Unit

    All property and returnValueOf taking an assertionCreator will return the same type as the current subject.

    🚚 I will remove out of Assert<out T> in order that things like asssert(1).toBe("hello") is no longer possible, overloads can be simplified etc.

    returnValueOf functions might be renamed to returnValueOfX where X denotes the number of arguments. Too often it occurs that Kotlin is not able to infer the correct overload, the user does not get the appropriate help in code completion or the error message is too big. This should help.

    🔋 feature assertion functions might require a lambda in the future. This way error reporting does not blow up in the middle of the way because subject is not available. However, there is a bug concerning nullable-features in Kotlin which prevents me from doing it at the moment: https://youtrack.jetbrains.com/issue/KT-23768, please up-vote it.

    A type parameter might be added to AssertionGroup to restrict the AssertionGroupType.

    📦 BulletPointIdentifier together with subtypes (AssertionGroupTypes) might be moved to another package: ch.tutteli.atrium.reporting.assertions

    👀 AssertionPlant/Assert will switch roles => AssertionPlant will be the typealias of Assert, see #26; should only break binary compatibility

    👀 I will introduce interface groups for RepoterBuilder as I did in other cases (e.g. see Descriptive); should only break binary compatibility

    🗄 Migrating deprecated functionality

    🚀 In case you migrate from a version < 0.7.0 then please have a look at the migration guide given in the Release Notes of 0.7.0.
    Otherwise you can use the suggested replacements (ALT + Enter -> Replace with ...)

    Ping me in the Atrium slack channel if you need help.

  • v0.8.0-RC1

    April 13, 2019
  • v0.8.0-beta

    April 13, 2019
  • v0.8.0-alpha

    January 19, 2019
  • v0.7.0

    November 29, 2018

    🚀 See https://github.com/robstoll/atrium/releases/tag/v0.7.0 for full information. This is a patch-fix-version for Android because the DEX compiler cannot handle ? in identifiers and treats module-info.class as normal classes instead of ignoring it.

    👍 v0.8.0 of Atrium will support JS as additional platform and will most probably provide a specific artifact for Android as well. Simplified this means, we won't ship an atrium.jar with 0.8.0-android as version but atrium-android.jar with version 0.8.0.

  • v0.7.0-RC2

    January 19, 2019
  • v0.7.0-RC1

    January 19, 2019
  • v0.7.0-android

    November 29, 2018

    🚀 See https://github.com/robstoll/atrium/releases/tag/v0.7.0 for full information. This is a patch-fix-version for Android because the DEX compiler cannot handle ? in identifiers and treats module-info.class as normal classes instead of ignoring it.

    👍 v0.8.0 of Atrium will support JS as additional platform and will most probably provide a specific artifact for Android as well. Simplified this means, we won't ship an atrium.jar with 0.8.0-android as version but atrium-android.jar with version 0.8.0.

  • v0.6.0

    July 20, 2018

    Jar's can be found here: https://bintray.com/robstoll/tutteli-jars/atrium/0.6.0
    API Maturity : Almost Stable
    Implementation Maturity : Development

    🏗 I provide more or less a stable API for users of Atrium. Only the ReporterBuilder, which you use to build your own assertion verb might slightly change its API (so migrating will be just a few lines in one file).
    🏗 There are most likely not any breaking changes in the API of the assertion functions/builders.
    However, I do not provide yet a stable API for the core of Atrium -- this might affect you as well if you write your own assertion functions. It also affects you if you provide your own implementation of the core of Atrium.

    🆕 New Features:

    • isNumericallyEqualTo and isNotNumericallyEqualTo for BigDecimal
    • isEqualIncludingScale and isNotEqualIncludingScale for BigDecimal
      => gives a hint in case of a failure where the assertion would have hold with isNumericallyEqualTo / isNotNumericallyEqualTo
    • 🗄 overload of toBe for BigDecimal which is deprecated, throws an UnsupportedOperationException and points the user to the above functions
    • same same but different for the overload of notToBe for BigDecimal
    • toBeWithErrorTolerance for floating point numbers (Float, Double, BigDecimal)
    • isLessThan, isLessThanOrEquals etc. is now available for Comparable<T> and no longer only for Number
    • containsRegex(...) as shortcut for contains.atLeast(1).regex(...)
    • ↔ integrated contains not into the sophisticated contains assertion builder (for CharSequence and Iterable)
      👀 => so that you see how many times it was contained when the assertion fails
    • 👍 identification lambdas for Iterable with nullable types. For instance, listOf(null, 1).contains { toBe(1) } was not possible so far (only List<Int> was supported)
    • 👀 made AssertionPairFormatter configurable, one can now chose for instance a multi-line formatter instead of same-line (see README#your-first-assertion for an example)
    • ↪ workaround for a Bug in Kotlin (please upvote it) which causes that returnValueOf cannot be used for methods with overloads.
    • ✅ I generalised the DownCaster to a TypeTransformer which you can reuse by using the impl-function _typeTransformation. You find an example for Either in TypeTransformerSpec.
    • I added a few issues with label help wanted so that you get an easy start to contribute to Atrium.

    💥 Breaking Changes:

    • ✂ removed deprecated ReporterBuilder::withDetailedObjectFormatter

    🗄 Deprecation:

    • ReporterBuilder::withSameLineTextAssertionFormatter -> use the suggested replacement

    🚀 Not included in this release yet

    • 🏗 sophisticated assertion builder for toBe with error tolerance for floating point numbers
    • failure hint for toBe in conjuction with Float or Double
    • simplify the creation of failure hints, make it reusable for users