Bot releases are hidden (Show)
Published by robstoll over 5 years ago
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.
Any?
), thanks to @dave08 for the discussiono
as alternative to this
in sub-assertions for the infix APIFeatures for assertion-function-writers:
first: T, vararg rest: T
(inside a function T, Array<out T>
) to R, Array<out R>
-js
suffix; you will have to migrate to bundle en_GB if you still use en_UK, see Migrating deprecated functionality below.-android
suffix => Thansk to @ultraon for reporting #52 regarding issues with module-info.classtoBe
if a keyword is passed inadvertentlykotlin.Int
instead of java.lang.Integer
).Planned (previously deprecated or announced)
Unplaned
Group
, GroupWithoutNullableEntries
and GroupWithNullableEntries
invariant. I doubt this will be a problem for someone, otherwise let me knowValue
, Values
, Entry
, Entries
invariant; in case you get problems, try to use user-site variance and specify out
thereLocale
and no longer java.util.LocaleKClass
instead of Class
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.
The following was deprecated and will be removed with 1.0.0:
Assert<Iterable>.containsStrictly
use containsExactly
instead.nullable
in their name => their counterpart without nullable
in their name where opened up to accept also nullable types (see #60 for details)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.0assert(mapOf("a" to 1)).keys {}
addAssertionsCreatedBy
/and {}
; they will throw an exception if no sub-assertion is definedT
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 errorPlease 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 (AssertionGroupType
s) 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
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.
Published by robstoll almost 6 years ago
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
.
Published by robstoll about 6 years ago
A minimal version of assertK including:
Not included in this release yet:
not
operatorPublished by robstoll about 6 years ago
Jar's can be found here: https://bintray.com/robstoll/tutteli-jars/atrium/0.2.0
Maturity: Development
Published by robstoll about 6 years ago
Jar's can be found here: https://bintray.com/robstoll/tutteli-jars/atrium/0.3.0
API Maturity: Almost Stable
Implementation Maturity: Development
(I provide a more or less a stable API for users of Atrium but not yet for implementers of atrium)
Published by robstoll about 6 years ago
Jar's can be found here: https://bintray.com/robstoll/tutteli-jars/atrium/0.4.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 only to build your own assertion verb might slightly change its API (so migrating will be just a few lines in one file). There won't be any 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 if you write your own assertion functions as well as when you provide your own implementation of the core of Atrium.
Functions to create single assertions and assertion groups.
Iterable<T>
Iterable<T>
contains assertions which support identification lambdas for nullable types.Published by robstoll about 6 years ago
Jar's can be found here: https://bintray.com/robstoll/tutteli-jars/atrium/0.5.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 if you write your own assertion functions. It also affects you if you provide your own implementation of the core of Atrium.
Assert<T>
as entry point for assertion functions instead of AssertionPlant<T>
.containsDefaultTranslationOf
is now also available in the sophisticated assertion builder for contains
assertions for CharSequence
it
as alias for subject
was removed, due to legitimate confusion (see #7). In case you already use it, then
you can re-add it yourself, paste the following into your assertionVerb.kt: val <T : Any> IAssertionPlant<T>.it get() : T = subject
However, I recommend you rename it to x
or something similar to avoid the confusion that it
is actually not an implicit lambda parameter.
The assertion function contains
for CharSequence
checks now that only CharSequence
, Number
and Char
are passed (at runtime).
I consider it as too risky (prone to bugs) if one can pass Any
thing -- well compile time still requires only Any
; that's because Kotlin does not (yet) support union types.
IMO it is not possible to define more restrictive types (e.g. with multiple overloads) which does not hinder usability and maintanability. That's the reason why it still expects Any
.
If someone misses the functionality that one can pass in any object, then please open a feature request.
atrium-api-code-completion-en_UK was renamed to atrium-api-cc-en_UK, same for atrium-api-code-completion-de_CH. In case you have not used the bunde module atrium-cc-en_UK-robstoll but the API directly, then you need to modify your build.gradle
Interfaces are no longer prefixed with I
with the exception of IAtriumFactory
Simplified the implementation for LocaleOrderDecider
-> special cases Norwegian and Chinese.
ResourceBundleBasedTranslator
internal1 -- if you are using ReporterBuilder.withoutTranslation()
or ReporterBuilder.withDefaultTranslator(...)
respectively, then you don't have to do anything. In case you used ResourceBundleBasedTranslator
, then use the mentioned methods instead.1 ResourceBundleBasedTranslator
is just a reference implementation to assure that TranslationSupplierBasedTranslator
is compatibel with ResourceBundle. Since it was compatible so far, one could have used ResourceBundleBasedTranslator
instead of TranslationSupplierBasedTranslator
as well. However, because I detected that there are bugs in the implementation of ResourceBundle in JDK8 I decided that ResourceBundleBasedTranslator
should no longe be visible to users (bugs are only concerning the special cases Norwegian and Chinese but maybe there are more).
ReporterBuilder::withDetailedObjectFormatter
will be removed in 0.6.0Iterable<T>
contains assertions which support identification lambdas for nullable types.Published by robstoll about 6 years ago
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.
isNumericallyEqualTo
and isNotNumericallyEqualTo
for BigDecimal
isEqualIncludingScale
and isNotEqualIncludingScale
for BigDecimal
isNumericallyEqualTo
/ isNotNumericallyEqualTo
toBe
for BigDecimal
which is deprecated, throws an UnsupportedOperationException
and points the user to the above functionsnotToBe
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(...)
contains not
into the sophisticated contains
assertion builder (for CharSequence
and Iterable
)Iterable
with nullable types. For instance, listOf(null, 1).contains { toBe(1) }
was not possible so far (only List<Int>
was supported)
AssertionPairFormatter
configurable, one can now chose for instance a multi-line formatter instead of same-line (see README#your-first-assertion for an example)returnValueOf
cannot be used for methods with overloads.DownCaster
to a TypeTransformer
which you can reuse by using the impl-function _typeTransformation
. You find an example for Either
in TypeTransformerSpec.ReporterBuilder::withDetailedObjectFormatter
ReporterBuilder::withSameLineTextAssertionFormatter
-> use the suggested replacementtoBe
with error tolerance for floating point numberstoBe
in conjuction with Float or DoublePublished by robstoll about 6 years ago
Jar's can be found here: https://bintray.com/robstoll/tutteli-jars/atrium/0.7.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. Yet, I deprecated quite a lot of with this release; please replace deprecated functionality until v1.0.0 where I will remove it.
However, I do not provide yet a stable API for the core of Atrium -- it is almost stable, but there might be slight breaking changes which I want to introduce before v1.0.0. That is also the reason why I have not yet established backward compatibility tests for the core. This might affect you if you write your own assertion functions. It also affects you if you provide your own implementation for parts of Atrium.
isEmpty
, isNotEmpty
and hasSize
for Map
messageContains
as shortcut function for message { contains(...) }
. You can still use message { ... }
for more sophisticated assertions. For instance, if a certain string should only be contained once in the message then you can use message { contains.exactly(1).values(...) }
. Or in case you want to be sure that something is not contained in the message message { contains(..); containsNot(...) }
.
toBe(null)
as replacement for isNull
(isNull will be removed with 1.0.0)
notToBeNull
as replacement for isNotNull
(isNotNull will be removed with 1.0.0)
notToBeNullBut
as shortuct function for notToBeNull { toBe(...) }
asIterable
for Sequence
and Array
added contains.inOrder.only.grouped.within.inAnyOrder
to the sophisticated contains
assertion builder for Iterable
added overloads to property
and returnValueOf
which allows to use a class reference rather than a bounded reference with the advantage that it is more robust when it comes to error reporting (since it does not need to access the reference to retrieve its name => see https://youtrack.jetbrains.com/issue/KT-23777 for more information)
=> personally I still use subject::...
when I write assertions as such (in tests) but use Class::...
inside assertion functions
added helper functions for people dealing with Java Code. Per default platform types are turned into a non-nullable version if possible. If you want to turn it into a nullable-version nonetheless, then you have to cast and restate the type. Depending on the type this might be cumbersome. Thus I introduced the following functions which give some extra hint to the compiler without actually adding code (they are all inline functions):
nullable
turns a type into a nullable type or a function reference into a function reference with a nullable return type.nullableContainer
turns an Iterable
into an iterable with nullable entry type, likewise it does the same for Array
.nullableValueMap
turns a Map
into a map with a nullable value type.Features for assertion-function-writers:
added function subAssert
which is basically an identity function and shall help to circumvent different bugs in Kotlin concerning overload resolution
=> for instance, FeatureAssertionsClassReferenceSpec makes use of it.
introduced AssertImpl as entry point for assertion-function-writers. It guides you to existing assertion function implementations as well as to the AssertionBuilder (see next point). For instance, you need a type transformation assertion, use AssertImpl.any.typeTransformation.transform
(see TypeTransformationAssertionCreatorSpec)
introduced AssertionBuilder which shall simplify the creation of assertions and thus the creation of assertion functions. For instance, add a failure hint with AssertImpl.builder.descriptive.withTest(...).withFailureHint(...).create(...)
(see bigDecimalAssertions.kt)
introduced AssertionCollector which ease to compose feature assertion functions. As example, have a look at collectionAssertions.kt
added AssertImpl.changeSubject which allows to transform an Assert<T>
into an Assert<Y>
without effects on reporting.
further stabilised the API of atrium-core
introduced APIs cc-en_GB
and cc-infix-en_GB
in favour of cc-en_UK
and cc-infix-en_UK
=> see below for migration guidelines
introduced atrium-domain modules in favour of atrium-assertion to provide a more stable API concerning impl-functions and sophisticated assertion builders
turned most modules into jdk9 modules (deprecated code was placed in separate modules ending with -deprecated
)
introduced the module atrium-bc-test
which ensures that, specs of 0.6.0:
message
of a thrown Exception
as well as the beginning of the stack trace is now shown in case it is of a different type than the expected one (gives you some extra hint).Assert
is now annotated with a DslMarker which assures that you do not call an assertion function of an outer subject inadvertently.Iterable<T: Any>
contain assertion functions do no longer allow to pass null
. Moreover, we added overloads for nullable where missing and renamed them to ...Nullable... (e.g. nullableValue or containsStrictlyNullableValues)isA
) in ReadmeSequence
and Array
in FAQ of Readmech.tutteli.atrium
=> adjust it next to the versionPlanned (previously deprecated or announced)
ReporterBuilder::withSameLineTextAssertionFormatter
was announced to be removed with 0.7.0 but will remain in the deprecated ReporterBuilder
in the deprecated module atrium-assertions and will remain there until 1.0.0. The new ReporterBuilder
in module atrium-domain-builders does not include this method.Unplaned
containsNot
checks in addition that the Iterable
returns at least one element (or in other words, it fails if Iterable
returns nothing).DefaultInvisibleAssertionGroupType
was removed, use InvisibleAssertionGroupType
instead, use AssertImpl.builder.invisibleGroup
respectively.subject
was removed from interface BaseReportingAssertionPlant
and ReportingAssertionPlantNullable
The following changes only bother you if you do not use a bundle module but specify the dependencies manually:
atrium-core-robstoll
instead of atrium-core-impl-robstoll
(or use one of the bundle modules).The following was deprecated and will be removed with 1.0.0:
isTrue()
and isFalse()
=> use toBe(true)
, toBe(false)
respectively (or re-add as your own function if you want to keep it)isNull
in API cc-en_UK => use toBe(null)
(or re-add as your own function if you want to keep it)isNotNull
in API cc-en_UK => use noToBeNull
(or re-add as your own function if you want to keep it)containsNot
for nullable values => you can use containsNot.nullableValues(...)
toThrow()
=> better there is only toThrow {}
this way you do not need to chose and IntelliJ can compelete the function quicker.isSame
and isNotSame
in favour of isSameAs
and isNotSameAs
inGiven order but only
in API cc-infix-en_UK => use inGiven order and only
object
and objects
of the sophisticated contains
assertion builder for Iterable
=> use value
, values
respectively.Translatable
=> was most likely only used by Atrium internally. Is no longer used thus will be removed. But in any case, there is no need to pollute the API with functions most users do not use.ReporterBuilder
in package ch.tutteli.atrium.reporting => moved to package ch.tutteli.atrium.domain.builders (to be JDK9 ready where split package is not allowed), yet its inaccessible, use reporterBuilder
insteadIndentAssertionGroup
together with IndentAssertionGroupType
and TextIndentAssertionGroupFormatter
=> please let me know (via slack or by opening an issue) if you used one of it. I happily show how you can achieve the same but differently.InvisibleAssertionGroup
-> use AssertImpl.builder.invisible
instead.AssertionGroup.Builder
-> use AssertImpl.builder
(one of the suggested replacements).IAtriumFactory
and AtriumFactory
in favour of ICoreFactory
, CoreFactory
respectively -> use the suggested replacement.DescriptiveAssertion::expected
use DescriptiveAssertion::representation
instead.assert
is a reserved keyword in Java and I would not have been able to define module-info.java where I export package assert
The following was deprecated and will be made internal
with 1.0.0:
BasicDescriptiveAssertion
-> use AssertImpl.builder.descriptive
insteadBasicExplanatoryAssertion
-> use AssertImpl.builder.explanatory
insteadBasicAssertionGroup
-> use AssertImpl.builder
ExplanatoryAssertionGroup
-> use AssertImpl.builder.explanatoryGroup
EmptyNameAndSubjectAssertionGroup
-> use AssertImpl.builder
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.
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.AssertionGroup
to restrict the AssertionGroupType
.BulletPointIdentifier
together with subtypes (AssertionGroupType
s) might be moved to another package: ch.tutteli.atrium.reporting.assertions
You have time to replace the deprecated functionality with the new solutions until 1.0.0 -- enough time I guess, I don't even know what 1.0.0 will contain exactly (surely html reporting and multi platform functionality, that might take a while).
I have placed corresponding ReplaceWith
into most of the @Deprecated
annotations. Unfortunately they do not all behave as I wish due to several bugs in this area (for instance: https://youtrack.jetbrains.com/issue/KT-24181, https://youtrack.jetbrains.com/issue/KT-10094)
Please file a bug if I have forgotten to place a replacement somewhere or if it does not work as expected (e.g., if I have forgotten to add an import). I gladly fix it and provide a patch version => better than you have to adjust things manually all over the place 😉.
The biggest deprecation is due to my silly mistake of using en_UK instead of en_GB (thanks to @robfletcher for pointing it out). Luckily though, it gave me the opportunity to provide an API which is deprecation free and JDK9 ready. That means, once you have transformed all your deprecated code, you can switch from the en_UK
bundle to the en_GB
bundle and if it still compiles then you can be sure, that you did not miss to migrate a deprecated entity and you are Atrium 1.0.0 compatible (in case you are using a de_CH bundle: müsst euch bis 1.0.0 gedulden, dann wird auch de_CH deprecation free und JDK9 ready sein).
Unfortunately, Intellij makes some replacements not terribly well, due to the following bug https://youtrack.jetbrains.com/issue/KT-10094.
As far as I have seen it only concerns consumers of the infix API (guidance is given by the following checklist).
Following a checklist which shall help you migrating things (I have done the same for migrating atrium-spec to use cc-en_GB instead of cc-en_UK).
You only need to consider the checklist for the bundle you use:
Please make sure you have enabled the search options "Match case" and "Regex" in the following search & replace instructions.
update dependency to ch.tutteli.atrium:atrium-cc-en_UK-robstoll:0.7.0
(notice groupId has changed to ch.tutteli.atrium
)
if you use a predefined verb:
search for: .(toThrow<[^>]+>)\(\)
replace with: .$1\{\}
Either you replace the deprecated functions using IntelliJ's function "replace with suggestion", or you can use the following approach which might need some manual adjustment in the end but not much I guess. Yet, I think you are still better of using this approach over "replace with suggestion" due to the following bug: https://youtrack.jetbrains.com/issue/KT-24181 which makes replacements not ideal.
search for: ReporterBuilder
=> in case you have a match:
buildOnlyFailureReporter
with the suggestion (ALT + Enter -> Replace with ...) => the code will not immediately compile, go on with the next step (at the end it will)ReporterBuilder
by reporterBuilder
import ch.tutteli.atrium.reporting.ReporterBuilder
in case you have defined your own assertion verbs
Configuration of the reporter can be done via verb directly but it is advisable to do it via ReporterFactory.
In case you do not use another configuration than the DefaultReporterFactory already defines, then it is enough if you just exchange your Reporter with reporter
(add import ch.tutteli.atrium.reporting.reporter
)
In case your configuration differs then you have to specify your own ReporterFactroy. See atriumVerbs.kt of API de_CH for an example how you define one. Furthermore, you need register your own ReporterFactory as service (ServiceLoader mechanism, see how it is done in API de_CH).
search for: (import ch.*)en_UK(.*)
replace with: $1en_GB$2
search for: isTrue\(\)
replace with: toBe(true)
search for: isFalse\(\)
replace with: toBe(false)
search for: import ch.*en_GB.is(?:True|False)([\S\s]*)(import ch.*en_GB).is(?:True|False)
replace with: $1$2.toBe
search for: isNull\(\)
replace with: toBe(null)
remove duplicated toBe
imports, you might have to replace multiple times:
search for: (import ch.*en_GB.toBe)([\S\s]*)import ch.*en_GB.toBe
replace with: $1$2
search for: isNotNull
replace with: notToBeNull
search for: isSame
replace with: isSameAs
search for: isNotSame
replace with: isNotSameAs
search for: ((?:inAnyOrder\.(?:only\.)?)|(?:inOrder\.only\.))`object`
replace with: $1value
search for: ((?:inAnyOrder\.(?:only\.)?)|(?:inOrder\.only\.))objects
replace with: $1values
You might have some errors in conjunction with Iterable with nullable elements (Iterable<T?>
) which you need to fix manually. There are replacements like nullableValue
instead of value
etc.
compile and see if you have deprecation warnings if so, fix them by using the suggested replacements
to test if you have removed all deprecated function you can adjust your gradle dependency and depend on atrium-cc-en_GB-robstoll instead of atrium-cc-en_UK-robstoll
remove the dependency to atrium-verbs in case you have defined it (is already defined in the bundle atrium-cc-en_GB-robstoll)
Ping me in the Atrium slack channel if you need help.
Please make sure you have enabled the search options "Match case" and "Regex" in the following search & replace instructions.
update dependency to Atrium as follows:
buildscript {
ext { atrium_version='0.7.0' }
}
repositories {
jcenter()
// either use jcenter or the repository on the next line
// maven { url "http://dl.bintray.com/robstoll/tutteli-jars" }
}
dependencies {
testCompile("ch.tutteli.atrium:atrium-cc-infix-en_GB-robstoll:$atrium_version") {
exclude group: 'ch.tutteli.atrium', module: 'atrium-api-cc-en_GB'
}
testRuntimeOnly("ch.tutteli.atrium:atrium-api-cc-en_GB-robstoll:$atrium_version")
}
We have to define an exclude
due to a missing feature (or you could call it a bug) so that maven dependencies defined with <scope>runtime</scope>
are treated as compile nonetheless.
If you are using gradle > 4.6, then you can put enableFeaturePreview("IMPROVED_POM_SUPPORT")
in your settings.gradle and simplify the dependencies section to the following:
dependencies {
testCompile "ch.tutteli.atrium:atrium-cc-infix-en_GB-robstoll:$atrium_version"
}
if you use a predefined verb:
search for: .(toThrow<[^>]+>)\(\)
replace with: .$1\{\}
Objects
was deprecated in favour of Values
-- I have not placed a ReplaceWith into the @Deprecated
annotation due to mentioned bug.
search for: ch.tutteli.atrium.api.cc.infix.en_UK.(Empty|contain|case|only|order)
replace with: ch.tutteli.atrium.api.cc.infix.en_GB.keywords.$1
=> this might not be as successful as I wish due to star import, you probably have to do some adjustments manually
Either you replace the deprecated functions using IntelliJ's function "replace with suggestion", or you can use the following approach which might need some manual adjustment in the end but not much I guess. Yet, I think you are still better of using this approach over "replace with suggestion" due to the following bug: https://youtrack.jetbrains.com/issue/KT-24181 which makes replacements not ideal.
search for: ReporterBuilder
=> in case you have a match:
withTranslationSupplier
and replace it with the suggested replacement (ALT + Enter -> Replace with ...)buildOnlyFailureReporter()
with .onlyFailureReporter().build()
import ch.tutteli.atrium.reporting.ReporterBuilder
in case you have defined your own assertion verbs
Configuration of the reporter can be done via verb directly but it is advisable to do it via ReporterFactory.
In case you do not use another configuration than the DefaultReporterFactory already defines, then it is enough if you just exchange your Reporter with reporter
(add import ch.tutteli.atrium.reporting.reporter
)
In case your configuration differs then you have to specify your own ReporterFactroy. See [atriumVerbs.kt of API de_CH)(https://github.com/robstoll/atrium/tree/v0.7.0/apis/atrium-api-cc-de_CH/src/test/kotlin/ch/tutteli/atrium/atriumVerbs.kt) for an example how you define one. Furthermore, you need register your own ReporterFactory as service (ServiceLoader mechanism, see how it is done in API de_CH).
search for: (import ch.*)en_UK(.*)
replace with: $1en_GB$2
search for: isSame
replace with: isSameAs
search for: isNotSame
replace with: isNotSameAs
search for: ((?:inAny order (?:but only)?)|(?:inGiven order but only) )object
replace with: $1value
search for: inGiven order but only
replace with: inGiven order and only
You might have some errors in conjunction with Iterable with nullable elements (Iterable<T?>
) which you need to fix manually. There are replacements like nullableValue
instead of value
etc.
to test if you have removed all deprecated function you can adjust your gradle dependency and depend on atrium-cc-infic-en_GB-robstoll instead of atrium-cc-infic-en_UK-robstoll
remove the dependency to atrium-verbs in case you have defined it (is already defined in the bundle atrium-cc-infic-en_GB-robstoll)
Ping me in the Atrium slack channel if you need help.
update dependency to Atrium as follows:
buildscript {
ext { atrium_version='0.7.0' }
}
repositories {
jcenter()
// either use jcenter or the repository on the next line
// maven { url "http://dl.bintray.com/robstoll/tutteli-jars" }
}
dependencies {
testCompile("ch.tutteli.atrium:atrium-cc-de_CH-robstoll:$atrium_version") {
exclude group: 'ch.tutteli.atrium', module: 'atrium-api-cc-en_GB'
}
testRuntimeOnly("ch.tutteli.atrium:atrium-api-cc-en_GB-robstoll:$atrium_version")
}
We have to define an exclude
due to a missing feature (or you could call it a bug) so that maven dependencies defined with <scope>runtime</scope>
are treated as compile nonetheless.
If you are using gradle > 4.6, then you can put enableFeaturePreview("IMPROVED_POM_SUPPORT")
in your settings.gradle and simplify the dependencies section to the following:
dependencies {
testCompile "ch.tutteli.atrium:atrium-cc-de_CH-robstoll:$atrium_version"
}
if you use a predefined verb:
search for: .(toThrow<[^>]+>)\(\)
replace with: .$1\{\}
search for: ReporterBuilder
=> in case you have a match:
buildOnlyFailureReporter
with the suggestion (ALT + Enter -> Replace with ...) => the code will not immediately compile, go on with the next step (at the end it will)ReporterBuilder
by reporterBuilder
import ch.tutteli.atrium.reporting.ReporterBuilder
use the suggested replacements for deprecated functions.
remove the dependency to atrium-verbs in case you have defined it (is already defined in the bundle atrium-cc-de_CH-robstoll)
Ping me in the Atrium slack channel if you need help.
toBe
with error tolerance for floating point numberstoBe
in conjuction with Float or Double