atrium v0.9.0-alpha Release Notes

Release Date: 2019-08-29 // over 4 years ago
  • 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