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 tofluent.en_GB
which makes use ofExpect
instead ofAssert
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
andasAssert
allow to switch between the oldAssert
and the newExpect
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.ExpectRepeat 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.ExpectSearch: 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) { itSearch: 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 fromAssertImpl.coreFactory.newReportingPlant
toExpectImpl.assertionVerbBuilder
๐ see atriumVerbs.kt for an example