diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/expectExtensions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/expectExtensions.kt index 65be33a15..4806bf695 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/expectExtensions.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/expectExtensions.kt @@ -3,8 +3,8 @@ package ch.tutteli.atrium.api.fluent.en_GB import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.None import ch.tutteli.atrium.creating.* -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder -import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.logic.creating.RootExpectOptions import ch.tutteli.atrium.reporting.Text @Suppress("DEPRECATION" /* RequiresOptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -20,7 +20,7 @@ annotation class ExperimentalWithOptions * In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]), * then the previous representation is used. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions fun RootExpect.withRepresentation(textRepresentation: String): Expect = @@ -39,32 +39,34 @@ fun RootExpect.withRepresentation(textRepresentation: String): Expect * In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]), * then the previous representation is used. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions fun RootExpect.withRepresentation(representationProvider: (T) -> Any): Expect = withOptions { withRepresentation(representationProvider) } /** - * Uses the given [configuration]-lambda to create an [ExpectOptions] which in turn is used - * to override (parts) of the existing configuration. + * Uses the given [configuration]-lambda to create an [RootExpectOptions] which in turn is used + * to re-define (parts) of the existing configuration. * - * @return an [Expect] for the subject of `this` expectation. - */ -@ExperimentalWithOptions -fun RootExpect.withOptions(configuration: ExpectBuilder.OptionsChooser.() -> Unit): Expect = - withOptions(ExpectBuilder.OptionsChooser.createAndBuild(configuration)) - -/** - * Uses the given [options] to override (parts) of the existing configuration. - * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @UseExperimental(ExperimentalNewExpectTypes::class) -fun RootExpect.withOptions(options: ExpectOptions): Expect = - RootExpect(this, options.toRootExpectOptions()) +fun RootExpect.withOptions(configuration: RootExpectBuilder.OptionsChooser.() -> Unit): Expect = + withOptions(RootExpectOptions(configuration)) + +/** + * Uses the given [options] to override (parts) of the existing configuration. + * + * @return An new [Expect] with the specified options for subject of `this` expectation. + */ +@ExperimentalWithOptions +@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) +@UseExperimental(ExperimentalNewExpectTypes::class) +fun RootExpect.withOptions(options: RootExpectOptions): Expect = + RootExpect(this, options) /** * Wraps the given [textRepresentation] into a [Text] and uses it as representation of the subject @@ -73,7 +75,7 @@ fun RootExpect.withOptions(options: ExpectOptions): Expect = * In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]), * then the previous representation is used. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -94,7 +96,7 @@ fun FeatureExpect.withRepresentation(textRepresentation: String): E * In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]), * then the previous representation is used. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -106,7 +108,7 @@ fun FeatureExpect.withRepresentation(representationProvider: (R) -> * Uses the given [configuration]-lambda to create an [FeatureExpectOptions] which in turn is used * to override (parts) of the existing configuration. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -117,7 +119,7 @@ fun FeatureExpect.withOptions(configuration: FeatureExpectOptionsCh /** * Uses the given [options] to override (parts) of the existing configuration. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/expectExtensions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/expectExtensions.kt index bfa33110c..213dd2951 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/expectExtensions.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/expectExtensions.kt @@ -3,8 +3,8 @@ package ch.tutteli.atrium.api.infix.en_GB import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.None import ch.tutteli.atrium.creating.* -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder -import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.logic.creating.RootExpectOptions import ch.tutteli.atrium.reporting.Text @Suppress("DEPRECATION" /* RequiresOptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -42,12 +42,15 @@ infix fun RootExpect.withRepresentation(representationProvider: (T) -> An withOptions { withRepresentation(representationProvider) } /** - * Uses the given [configuration]-lambda to create an [ExpectOptions] which in turn is used + * Uses the given [configuration]-lambda to create an [RootExpectOptions] which in turn is used * to override (parts) of the existing configuration. */ @ExperimentalWithOptions -infix fun RootExpect.withOptions(configuration: ExpectBuilder.OptionsChooser.() -> Unit): Expect = - withOptions(ExpectBuilder.OptionsChooser.createAndBuild(configuration)) +@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) +@UseExperimental(ExperimentalNewExpectTypes::class) +infix fun RootExpect.withOptions(configuration: RootExpectBuilder.OptionsChooser.() -> Unit): Expect = + withOptions(RootExpectOptions(configuration)) + /** * Uses the given [options] to override (parts) of the existing configuration. @@ -55,8 +58,8 @@ infix fun RootExpect.withOptions(configuration: ExpectBuilder.OptionsChoo @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @UseExperimental(ExperimentalNewExpectTypes::class) -infix fun RootExpect.withOptions(options: ExpectOptions): Expect = - RootExpect(this, options.toRootExpectOptions()) +infix fun RootExpect.withOptions(options: RootExpectOptions): Expect = + RootExpect(this, options) /** * Wraps the given [textRepresentation] into a [Text] and uses it as representation of the subject @@ -65,7 +68,7 @@ infix fun RootExpect.withOptions(options: ExpectOptions): Expect = * In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]), * then the previous representation is used. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -86,7 +89,7 @@ infix fun FeatureExpect.withRepresentation(textRepresentation: Stri * In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]), * then the previous representation is used. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -98,7 +101,7 @@ infix fun FeatureExpect.withRepresentation(representationProvider: * Uses the given [configuration]-lambda to create an [FeatureExpectOptions] which in turn is used * to override (parts) of the existing configuration. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) @@ -109,7 +112,7 @@ infix fun FeatureExpect.withOptions(configuration: FeatureExpectOpt /** * Uses the given [options] to override (parts) of the existing configuration. * - * @return an [Expect] for the subject of `this` expectation. + * @return An new [Expect] with the specified options for subject of `this` expectation. */ @ExperimentalWithOptions @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/ExplanatoryAssertion.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/ExplanatoryAssertion.kt index 70f0e6151..ccc1b469f 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/ExplanatoryAssertion.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/ExplanatoryAssertion.kt @@ -10,7 +10,7 @@ import ch.tutteli.atrium.reporting.ObjectFormatter * As it is a child of an [AssertionGroup] with an [ExplanatoryAssertionGroupType], it is not of importance * whether the assertions holds or not; thus it overrides [holds] which always returns `true`. * - * This assertion will be turned into a `Reportable` with 1.0.0 and eventually be removed with 1.0.0 + * This assertion will be turned into a `Reportable` with 1.0.0 and eventually/latest be removed with 1.0.0 * See https://github.com/robstoll/atrium-roadmap/issues/1 for more information. */ interface ExplanatoryAssertion : Assertion { diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt index 200436533..59fbee774 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt @@ -10,7 +10,7 @@ import kotlin.reflect.KClass /** * Represents the extension point of the logic level for subjects of type [T]. * - * In contrast to assertion function defined for [Expect] which usually return [Expect], functions defined for + * In contrast to expectation functions defined for [Expect] which usually return [Expect], functions defined for * [AssertionContainer] return [Assertion] so that they can be appended to whatever we want. * * Note, do not use [SubjectProvider] as this interface will be removed with 0.17.0. diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/DelegatingExpect.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/DelegatingExpect.kt index 6b454953c..aa69e98c7 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/DelegatingExpect.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/DelegatingExpect.kt @@ -1,11 +1,12 @@ package ch.tutteli.atrium.creating +import ch.tutteli.atrium.assertions.Assertion import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.Option import ch.tutteli.atrium.creating.impl.DelegatingExpectImpl /** - * Represents an [Expect] which passes on appended assertions to a given [Expect]. + * Represents an [Expect] which passes on appended [Assertion]s to a given [Expect]. */ interface DelegatingExpect : Expect { companion object { diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/ErrorMessages.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/ErrorMessages.kt index 086c699df..9547d53f7 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/ErrorMessages.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/ErrorMessages.kt @@ -7,6 +7,7 @@ import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable */ enum class ErrorMessages(override val value: String) : StringBasedTranslatable { AT_LEAST_ONE_ASSERTION_DEFINED("at least one assertion defined"), + //TODO 0.16.0 deprecate and replace with FORGOT_DO_DEFINE_EXPECTATION FORGOT_DO_DEFINE_ASSERTION("You forgot to define assertions in the assertionCreator-lambda"), HINT_AT_LEAST_ONE_ASSERTION_DEFINED("Sometimes you can use an alternative to `{ }` For instance, instead of `toThrow<..> { }` you should use `toThrow<..>()`"), } diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt index 12f7dd68f..1cf4f2263 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt @@ -51,7 +51,6 @@ interface Expect : @kotlin.Suppress("DEPRECATION") SubjectProvider { ReplaceWith("this._logic.maybeSubject", "ch.tutteli.atrium.logic._logic") ) override val maybeSubject: Option - get() = TODO("Not yet implemented") /** * Adds the assertions created by the [assertionCreator] lambda to this container and diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/FeatureExpectOptions.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/FeatureExpectOptions.kt index 0aecf8f33..0b91e2380 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/FeatureExpectOptions.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/FeatureExpectOptions.kt @@ -33,7 +33,7 @@ data class FeatureExpectOptions( ) } - +//TODO 0.16.0 deprecate and move to logic /** * Define additional (non-mandatory) options to create a [FeatureExpect] based on a given * [FeatureExpectOptionsChooser]-lambda. @@ -44,6 +44,7 @@ data class FeatureExpectOptions( fun FeatureExpectOptions(configuration: FeatureExpectOptionsChooser.() -> Unit): FeatureExpectOptions = FeatureExpectOptionsChooser(configuration) +//TODO 0.16.0 deprecate and move to logic /** * Helper lambda to specify [FeatureExpectOptions] via convenience methods. * diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpect.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpect.kt index 0a96b70f2..709d48890 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpect.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpect.kt @@ -17,8 +17,8 @@ interface RootExpect : Expect { operator fun invoke( maybeSubject: Option, assertionVerb: Translatable, - expectOptions: RootExpectOptions? - ): RootExpect = RootExpectImpl(maybeSubject, assertionVerb, expectOptions) + options: RootExpectOptions? + ): RootExpect = RootExpectImpl(maybeSubject, assertionVerb, options) @ExperimentalNewExpectTypes /** @@ -26,9 +26,9 @@ interface RootExpect : Expect { */ operator fun invoke( rootExpect: RootExpect, - expectOptions: RootExpectOptions + options: RootExpectOptions ): RootExpect = when (rootExpect) { - is RootExpectImpl -> RootExpectImpl(rootExpect, expectOptions) + is RootExpectImpl -> RootExpectImpl(rootExpect, options) else -> throw UnsupportedOperationException("Please open an issue that a hook shall be implemented: $BUG_REPORT_URL?template=feature_request&title=Hook%20for%20RootExpect%20creation") } } diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpectOptions.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpectOptions.kt index 36a348754..8a1f0ae7b 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpectOptions.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/RootExpectOptions.kt @@ -7,16 +7,22 @@ import ch.tutteli.atrium.reporting.translating.Translatable /** * Additional (non-mandatory) options to create a [RootExpect]. * - * @property assertionVerb Defines a custom assertion verb if not null. + * See atrium-logic for helper functions to create an instance for this. Core is kept simple on purpose because + * it is also used in other JVM languages than Kotlin. + * + * @property expectationVerb Defines a custom assertion verb if not null. * @property representationInsteadOfSubject Defines a custom representation based on a present subject if not null. * @property reporter Defines a custom reporter if not null. */ @ExperimentalNewExpectTypes data class RootExpectOptions( - val assertionVerb: Translatable?, + val expectationVerb: Translatable?, val representationInsteadOfSubject: ((T) -> Any)?, val reporter: Reporter? ) { + @Deprecated("Use expectationVerb; will be removed latest with 1.0.0 (maybe earlier)") + val assertionVerb = expectationVerb + /** * Merges the given [options] with this object creating a new [RootExpectOptions] * where defined properties in [options] will have precedence over properties defined in this instance. @@ -27,7 +33,7 @@ data class RootExpectOptions( */ fun merge(options: RootExpectOptions): RootExpectOptions = RootExpectOptions( - options.assertionVerb ?: assertionVerb, + options.expectationVerb ?: expectationVerb, options.representationInsteadOfSubject ?: representationInsteadOfSubject, options.reporter ?: reporter ) diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt index b7f056279..61d8239a3 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt @@ -15,7 +15,7 @@ import ch.tutteli.atrium.reporting.translating.Translatable @ExperimentalNewExpectTypes internal class RootExpectImpl( maybeSubject: Option, - private val assertionVerb: Translatable, + private val expectationVerb: Translatable, private val representation: Any?, private val reporter: Reporter ) : BaseExpectImpl(maybeSubject), RootExpect { @@ -26,7 +26,7 @@ internal class RootExpectImpl( options: RootExpectOptions? ) : this( maybeSubject, - options?.assertionVerb ?: assertionVerb, + options?.expectationVerb ?: assertionVerb, determineRepresentation( options?.representationInsteadOfSubject, maybeSubject @@ -36,7 +36,7 @@ internal class RootExpectImpl( constructor(previous: RootExpectImpl, options: RootExpectOptions) : this( previous.maybeSubject, - previous.assertionVerb, + previous.expectationVerb, options ) @@ -50,7 +50,7 @@ internal class RootExpectImpl( assertions.add(assertion) if (!assertion.holds()) { val assertionGroup = assertionBuilder.root - .withDescriptionAndRepresentation(assertionVerb, representation) + .withDescriptionAndRepresentation(expectationVerb, representation) .withAssertion(assertion) .build() diff --git a/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackTest.kt b/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackTest.kt index 247ee8f71..bd8248be8 100644 --- a/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackTest.kt +++ b/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackTest.kt @@ -3,10 +3,11 @@ package ch.tutteli.atrium.core.robstoll.lib.reporting import ch.tutteli.atrium.api.fluent.en_GB.* import ch.tutteli.atrium.api.verbs.internal.AssertionVerb import ch.tutteli.atrium.api.verbs.internal.expect +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.core.polyfills.stackBacktrace -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder -import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.logic.creating.RootExpectOptions import ch.tutteli.atrium.reporting.AtriumErrorAdjuster import ch.tutteli.atrium.reporting.reporter import kotlin.test.Test @@ -79,9 +80,11 @@ class AdjustStackTest { subject, coreFactory.newRemoveAtriumFromAtriumErrorAdjuster() ) + @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) + @UseExperimental(ExperimentalNewExpectTypes::class) private fun createExpect(subject: T, adjuster: AtriumErrorAdjuster) = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(AssertionVerb.EXPECT) - .withOptions(ExpectOptions(reporter = DelegatingReporter(reporter, adjuster))) + .withOptions(RootExpectOptions(reporter = DelegatingReporter(reporter, adjuster))) .build() } diff --git a/core/robstoll-lib/atrium-core-robstoll-lib-jvm/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackSpec.kt b/core/robstoll-lib/atrium-core-robstoll-lib-jvm/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackSpec.kt index 70f139b14..5016d8e80 100644 --- a/core/robstoll-lib/atrium-core-robstoll-lib-jvm/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackSpec.kt +++ b/core/robstoll-lib/atrium-core-robstoll-lib-jvm/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackSpec.kt @@ -3,11 +3,12 @@ package ch.tutteli.atrium.core.robstoll.lib.reporting import ch.tutteli.atrium.api.fluent.en_GB.* import ch.tutteli.atrium.api.verbs.internal.AssertionVerb import ch.tutteli.atrium.api.verbs.internal.expect +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.core.polyfills.stackBacktrace import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder -import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.logic.creating.RootExpectOptions import ch.tutteli.atrium.logic.utils.expectLambda import ch.tutteli.atrium.reporting.AtriumErrorAdjuster import ch.tutteli.atrium.reporting.reporter @@ -177,8 +178,10 @@ class AdjustStackSpec : Spek({ } }) +@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) +@UseExperimental(ExperimentalNewExpectTypes::class) private fun createExpect(subject: T, adjuster: AtriumErrorAdjuster) = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(AssertionVerb.EXPECT) - .withOptions(ExpectOptions(reporter = DelegatingReporter(reporter, adjuster))) + .withOptions(RootExpectOptions(reporter = DelegatingReporter(reporter, adjuster))) .build() diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/RootExpectBuilder.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/RootExpectBuilder.kt new file mode 100644 index 000000000..0bc7ed257 --- /dev/null +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/RootExpectBuilder.kt @@ -0,0 +1,216 @@ +package ch.tutteli.atrium.logic.creating + +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.creating.RootExpect +import ch.tutteli.atrium.creating.RootExpectOptions +import ch.tutteli.atrium.logic.creating.impl.* +import ch.tutteli.atrium.reporting.Reporter +import ch.tutteli.atrium.reporting.Text +import ch.tutteli.atrium.reporting.translating.Translatable +import ch.tutteli.atrium.reporting.translating.Untranslatable + +/** + * Defines the contract to create custom expectation verbs, `RootExpect` respectively. + */ +interface RootExpectBuilder { + companion object { + + /** + * Entry point to use the [RootExpectBuilder] which helps in creating + * an expectation verb for the given [subject] or in other words a [RootExpect] for the given [subject]. + */ + fun forSubject(subject: T): ExpectationVerbStep = ExpectationVerbStepImpl(subject) + } + + /** + * Step which allows to specify the expectation verb which shall be used. + * + * @param T the type of the subject. + */ + interface ExpectationVerbStep { + /** + * The previously specified subject of the expectation. + */ + val subject: T + + /** + * Wraps the given [verb] into an [Untranslatable] and uses it as expectation verb. + */ + fun withVerb(verb: String): OptionsStep = withVerb(Untranslatable(verb)) + + /** + * Uses the given [verb] as expectation verb. + */ + fun withVerb(verb: Translatable): OptionsStep + } + + /** + * Step which allows to override previously defined properties -- such as use a different expectation verb -- but + * also allows to define options where usually a default value is used, such as use a custom [Reporter]. + * + * @param T the type of the subject. + */ + interface OptionsStep { + /** + * The previously specified subject of the expectation. + */ + val subject: T + + /** + * The previously defined expectation verb. + */ + val expectationVerb: Translatable + + + /** + * Allows to define the [RootExpectOptions] via an [OptionsChooser]-lambda which provides convenience functions. + * + * The functions usually start with `set...` and are sometimes overloaded to ease the configuration. + * Note that the last configuration + */ + @ExperimentalNewExpectTypes + fun withOptions(configuration: OptionsChooser.() -> Unit): FinalStep = + withOptions(RootExpectOptions(configuration)) + + /** + * Uses the given [rootExpectOptions]. + */ + @ExperimentalNewExpectTypes + fun withOptions(rootExpectOptions: RootExpectOptions): FinalStep + + /** + * States explicitly that no optional [RootExpectOptions] are defined, which means, `build` will create + * a new [Expect] based on the previously defined mandatory options but without any optional options or + * in other words, the default values are used for the optional options. + * + * Use [withOptions] if you want to define optional [RootExpectOptions] such as, override the + * verb, define an own representation or use an own [Reporter]. + */ + fun withoutOptions(): FinalStep + + companion object { + fun create( + subject: T, + expectationVerb: Translatable + ): OptionsStep = OptionsStepImpl(subject, expectationVerb) + } + } + + /** + * Helper lambda to specify [RootExpectOptions] via convenience methods. + * + * Calling multiple times the same method overrides the previously defined value. + */ + interface OptionsChooser { + + /** + * Wraps the given [verb] into an [Untranslatable] and passes it to the overload + * which expects a [Translatable] -- this is then used as custom expectation verb + * instead of the previously defined verb. + * + */ + fun withVerb(verb: String) { + withVerb(Untranslatable(verb)) + } + + /** + * Uses the given [verb] as expectation verb instead of the previously defined verb. + */ + fun withVerb(verb: Translatable) + + /** + * Wraps the given [textRepresentation] into a [Text] and uses it as representation of the subject + * instead of the representation that has been defined so far (which defaults to the subject itself). + */ + fun withRepresentation(textRepresentation: String): Unit = + withRepresentation { Text(textRepresentation) } + + /** + * Uses the given [representationProvider] to retrieve a representation which can be based on the current + * subject where it is used as new representation of the subject + * instead of the representation that has been defined so far (which defaults to the subject itself). + * + * Notice, if you want to use text (a [String] which is treated as raw string in reporting) as representation, + * then wrap it into a [Text] and pass it instead. + * If your text does not include the current subject, then we recommend to use the other overload which expects + * a `String` and does the wrapping for you. + */ + fun withRepresentation(representationProvider: (T) -> Any) + + /** + * Uses the given [reporter] instead of the default reporter. + */ + fun withReporter(reporter: Reporter) + + companion object { + @ExperimentalNewExpectTypes + fun createAndBuild(configuration: OptionsChooser.() -> Unit): RootExpectOptions = + OptionsChooserImpl().apply(configuration).build() + } + } + + /** + * Final step in the [RootExpect] building process which creates a new [RootExpect] based + * on the so far specified options. + * + * @param T the type of the subject. + */ + interface FinalStep { + /** + * The previously specified subject of the expectation. + */ + val subject: T + + /** + * The previously defined expectation verb. + */ + val expectationVerb: Translatable + + /** + * Either the previously specified [RootExpectOptions] or `null`. + */ + @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) + @UseExperimental(ExperimentalNewExpectTypes::class) + val options: RootExpectOptions? + + /** + * Creates a new [Expect] based on the previously defined maybeOptions. + */ + fun build(): RootExpect + + companion object { + @ExperimentalNewExpectTypes + fun create( + subject: T, + expectationVerb: Translatable, + options: RootExpectOptions? + ): FinalStep = FinalStepImpl(subject, expectationVerb, options) + } + } +} + +/** + * Helper function to create a [RootExpectOptions] via + */ +@ExperimentalNewExpectTypes +@Suppress("FunctionName") +fun RootExpectOptions(configuration: RootExpectBuilder.OptionsChooser.() -> Unit): RootExpectOptions = + RootExpectBuilder.OptionsChooser.createAndBuild(configuration) + +/** + * Helper function to create a [RootExpectOptions] by specifying components via named parameters. + * + * You can use it as follows: `RootExpectOptions(reporter = myReporter)` + */ +@ExperimentalNewExpectTypes +@Suppress("FunctionName") +fun RootExpectOptions( + expectationVerb: Translatable? = null, + representationInsteadOfSubject: ((T) -> Any)? = null, + reporter: Reporter? = null +): RootExpectOptions = RootExpectOptions( + expectationVerb, + representationInsteadOfSubject, + reporter +) diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/impl/OptionsChooserImpl.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/impl/OptionsChooserImpl.kt new file mode 100644 index 000000000..33b6911fd --- /dev/null +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/impl/OptionsChooserImpl.kt @@ -0,0 +1,28 @@ +package ch.tutteli.atrium.logic.creating.impl + +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes +import ch.tutteli.atrium.creating.RootExpectOptions +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.reporting.Reporter +import ch.tutteli.atrium.reporting.translating.Translatable + +@ExperimentalNewExpectTypes +class OptionsChooserImpl : RootExpectBuilder.OptionsChooser { + private var description: Translatable? = null + private var representationInsteadOfSubject: ((T) -> Any)? = null + private var reporter: Reporter? = null + + override fun withVerb(verb: Translatable) { + this.description = verb + } + + override fun withRepresentation(representationProvider: (T) -> Any) { + this.representationInsteadOfSubject = representationProvider + } + + override fun withReporter(reporter: Reporter) { + this.reporter = reporter + } + + fun build(): RootExpectOptions = RootExpectOptions(description, representationInsteadOfSubject, reporter) +} diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/impl/defaultImpls.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/impl/defaultImpls.kt new file mode 100644 index 000000000..2f2e0299e --- /dev/null +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/impl/defaultImpls.kt @@ -0,0 +1,40 @@ +package ch.tutteli.atrium.logic.creating.impl + +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes +import ch.tutteli.atrium.core.Some +import ch.tutteli.atrium.creating.RootExpect +import ch.tutteli.atrium.creating.RootExpectOptions +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.reporting.translating.Translatable + +class ExpectationVerbStepImpl(override val subject: T) : RootExpectBuilder.ExpectationVerbStep { + override fun withVerb(verb: Translatable): RootExpectBuilder.OptionsStep = + RootExpectBuilder.OptionsStep.create(subject, verb) +} + +class OptionsStepImpl( + override val subject: T, + override val expectationVerb: Translatable +) : RootExpectBuilder.OptionsStep { + + @ExperimentalNewExpectTypes + override fun withOptions(rootExpectOptions: RootExpectOptions): RootExpectBuilder.FinalStep = + toFinalStep(rootExpectOptions) + + @ExperimentalNewExpectTypes + override fun withoutOptions(): RootExpectBuilder.FinalStep = toFinalStep(null) + + @ExperimentalNewExpectTypes + private fun toFinalStep(rootExpectOptions: RootExpectOptions?) = + RootExpectBuilder.FinalStep.create(subject, expectationVerb, rootExpectOptions) +} + +@ExperimentalNewExpectTypes +class FinalStepImpl( + override val subject: T, + override val expectationVerb: Translatable, + override val options: RootExpectOptions? +) : RootExpectBuilder.FinalStep { + + override fun build(): RootExpect = RootExpect(Some(subject), expectationVerb, options) +} diff --git a/logic/atrium-logic-jvm/src/module/module-info.java b/logic/atrium-logic-jvm/src/module/module-info.java index 5043a1a61..243464f74 100644 --- a/logic/atrium-logic-jvm/src/module/module-info.java +++ b/logic/atrium-logic-jvm/src/module/module-info.java @@ -4,6 +4,7 @@ module ch.tutteli.atrium.logic { requires kotlin.stdlib; exports ch.tutteli.atrium.logic; + exports ch.tutteli.atrium.logic.creating; exports ch.tutteli.atrium.logic.creating.basic.contains; exports ch.tutteli.atrium.logic.creating.charsequence.contains; diff --git a/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/ExpectBuilder.kt b/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/ExpectBuilder.kt index 4d66e24b1..052bbbabd 100644 --- a/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/ExpectBuilder.kt +++ b/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/ExpectBuilder.kt @@ -1,3 +1,6 @@ +//TODO remove latest with 1.0.0 +@file:Suppress("DEPRECATION") + package ch.tutteli.atrium.domain.builders.reporting import ch.tutteli.atrium.core.ExperimentalNewExpectTypes @@ -19,7 +22,10 @@ import ch.tutteli.atrium.reporting.translating.Untranslatable /** * Defines the contract to create custom assertion verbs, `Expect` respectively. */ -//TODO move to atrium-logic with 0.16.0 +@Deprecated( + "Use RootExpectBuilder from atrium-logic; will be removed latest with 1.0.0 (maybe earlier)", + ReplaceWith("RootExpectBuilder", "ch.tutteli.atrium.logic.creating.RootExpectBuilder") +) interface ExpectBuilder { companion object { @@ -27,6 +33,13 @@ interface ExpectBuilder { * Entry point to use the [ExpectBuilder] which helps in creating * an assertion verb for the given [subject] or in other words an [Expect] for the given [subject]. */ + @Deprecated( + "Use RootExpectBuilder from atrium-logic; will be removed latest with 1.0.0 (maybe earlier)", + ReplaceWith( + "RootExpectBuilder.forSubject(subject)", + "ch.tutteli.atrium.logic.creating.RootExpectBuilder" + ) + ) fun forSubject(subject: T): AssertionVerbStep = AssertionVerbStepImpl(Some(subject)) } @@ -35,6 +48,7 @@ interface ExpectBuilder { * * @param T the type of the subject. */ + @Deprecated("Use RootExpectBuilder.ExpectationVerbStep from atrium-logic; will be removed latest with 1.0.0 (maybe earlier)") interface AssertionVerbStep { /** * The previously specified subject of `this` expectation. @@ -58,6 +72,7 @@ interface ExpectBuilder { * * @param T the type of the subject. */ + @Deprecated("Use RootExpectBuilder.OptionsStep from atrium-logic; will be removed latest with 1.0.0 (maybe earlier)") interface OptionsStep { /** * The previously specified subject of `this` expectation. @@ -94,6 +109,10 @@ interface ExpectBuilder { fun withoutOptions(): FinalStep companion object { + @Deprecated( + "Use OptionsStep from atrium-logic; will be removed with 0.17.0", + ReplaceWith("ch.tutteli.atrium.logic.creating.ExpectBuilder.OptionsStep.create(maybeSubject, assertionVerb)") + ) fun create( maybeSubject: Option, assertionVerb: Translatable @@ -106,7 +125,10 @@ interface ExpectBuilder { * * Calling multiple times the same method overrides the previously defined value. */ - //TODO move to atrium-core with 0.16.0 (or to logic and move FeatureExpectOptionsChooser to logic as well?) + @Deprecated( + "Use RootExpectBuilder.OptionsChooser from atrium-logic; will be removed latest with 1.0.0 (maybe earlier)", + ReplaceWith(" RootExpectBuilder.OptionsChooser", "ch.tutteli.atrium.logic.creating.RootExpectBuilder") + ) interface OptionsChooser { /** @@ -153,6 +175,10 @@ interface ExpectBuilder { fun withReporter(reporter: Reporter) companion object { + @Deprecated( + "Use the helper function OptionsChooser from atrium-logic", + ReplaceWith("RootExpectOptions(configuration)", "ch.tutteli.atrium.logic.creating.RootExpectOptions") + ) fun createAndBuild(configuration: OptionsChooser.() -> Unit): ExpectOptions = OptionsChooserImpl().apply(configuration).build() } @@ -163,6 +189,7 @@ interface ExpectBuilder { * * @param T the type of the subject. */ + @Deprecated("Use RootExpectBuilder.FinalStep from atrium-logic; will be removed latest with 1.0.0 (maybe earlier)") interface FinalStep { /** * The previously specified subject of `this` expectation. @@ -185,6 +212,10 @@ interface ExpectBuilder { fun build(): RootExpect companion object { + @Deprecated( + "Use OptionsStep from atrium-logic; will be removed with 0.17.0", + ReplaceWith("ch.tutteli.atrium.logic.creating.ExpectBuilder.FinalStep.create(maybeSubject, assertionVerb, options)") + ) fun create( maybeSubject: Option, assertionVerb: Translatable, @@ -201,6 +232,13 @@ interface ExpectBuilder { * @property representationInsteadOfSubject Defines a custom representation based on a present subject if not null. * @property reporter Defines a custom reporter if not null. */ +@Deprecated( + "Use RootExpectOptions instead; will be removed latest with 1.0.0 (maybe earlier)", + ReplaceWith( + "RootExpectOptions(assertionVerb, representationInsteadOfSubject, reporter)", + "ch.tutteli.atrium.logic.creating.RootExpectOptions" + ) +) data class ExpectOptions( val assertionVerb: Translatable? = null, val representationInsteadOfSubject: ((T) -> Any)? = null, @@ -227,5 +265,9 @@ data class ExpectOptions( } @Suppress("FunctionName") +@Deprecated( + "Use RootExpectOptions instead; will be removed latest with 1.0.0 (maybe earlier)", + ReplaceWith("RootExpectOptions(configuration)", "ch.tutteli.atrium.logic.creating.RootExpectOptions") +) fun ExpectOptions(configuration: ExpectBuilder.OptionsChooser.() -> Unit): ExpectOptions = ExpectBuilder.OptionsChooser.createAndBuild(configuration) diff --git a/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/OptionsChooserImpl.kt b/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/OptionsChooserImpl.kt index 9789d677d..ed3349261 100644 --- a/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/OptionsChooserImpl.kt +++ b/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/OptionsChooserImpl.kt @@ -1,3 +1,6 @@ +//TODO remove file with 1.0.0 +@file:Suppress("DEPRECATION") + package ch.tutteli.atrium.domain.builders.reporting.impl.verb import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder diff --git a/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/defaultImpls.kt b/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/defaultImpls.kt index e5c2767dc..9a4b6b2f7 100644 --- a/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/defaultImpls.kt +++ b/misc/deprecated/domain/builders/atrium-domain-builders-common/src/main/kotlin/ch/tutteli/atrium/domain/builders/reporting/impl/verb/defaultImpls.kt @@ -1,3 +1,6 @@ +//TODO remove file with 1.0.0 +@file:Suppress("DEPRECATION") + package ch.tutteli.atrium.domain.builders.reporting.impl.verb import ch.tutteli.atrium.core.ExperimentalNewExpectTypes diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt index c5a466232..0f3e051f3 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt @@ -8,12 +8,13 @@ import ch.tutteli.atrium.assertions.Assertion import ch.tutteli.atrium.assertions.AssertionGroup import ch.tutteli.atrium.assertions.ExplanatoryAssertionGroupType import ch.tutteli.atrium.assertions.builders.assertionBuilder +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.None import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.creating.CollectingExpect import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder -import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.logic.creating.RootExpectOptions import org.spekframework.spek2.Spek import org.spekframework.spek2.style.specification.describe @@ -31,10 +32,13 @@ abstract class SubjectLessSpec( expandAssertionGroups(assertions) - val container = ExpectBuilder.forSubject(1.0) + + @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) + @UseExperimental(ExperimentalNewExpectTypes::class) + val container = RootExpectBuilder.forSubject(1.0) .withVerb("custom assertion verb") .withOptions( - ExpectOptions( + RootExpectOptions( reporter = coreFactory.newOnlyFailureReporter( coreFactory.newAssertionFormatterFacade(coreFactory.newAssertionFormatterController()), coreFactory.newNoOpAtriumErrorAdjuster() diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/verbs/VerbSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/verbs/VerbSpec.kt index 8f36583a4..950ac651b 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/verbs/VerbSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/verbs/VerbSpec.kt @@ -1,13 +1,14 @@ package ch.tutteli.atrium.specs.verbs import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.polyfills.fullName import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder -import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions import ch.tutteli.atrium.domain.builders.reporting.ReporterBuilder import ch.tutteli.atrium.logic._logic import ch.tutteli.atrium.logic.changeSubject +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.logic.creating.RootExpectOptions import ch.tutteli.atrium.specs.AssertionVerb import ch.tutteli.atrium.specs.prefixedDescribeTemplate import ch.tutteli.atrium.specs.toBeDescr @@ -171,11 +172,14 @@ private fun Suite.testNonNullableSubject(assertionVerb: (Int) -> Expect) { } } + +@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) +@UseExperimental(ExperimentalNewExpectTypes::class) // does not make sense to test the verbs with the verbs themselves. Thus we create our own assertion verb here private fun assert(act: () -> R): Expect<() -> R> = - ExpectBuilder.forSubject(act) + RootExpectBuilder.forSubject(act) .withVerb(AssertionVerb.EXPECT_THROWN) - .withOptions(ExpectOptions(reporter = AtriumReporterSupplier.REPORTER)) + .withOptions(RootExpectOptions(reporter = AtriumReporterSupplier.REPORTER)) .build() private object AtriumReporterSupplier { diff --git a/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt b/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt index 38f450112..89d0134e1 100644 --- a/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt +++ b/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt @@ -2,8 +2,9 @@ package ch.tutteli.atrium.specs.reporting.translating import ch.tutteli.atrium.api.fluent.en_GB.* import ch.tutteli.atrium.api.verbs.internal.expect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder -import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes +import ch.tutteli.atrium.logic.creating.RootExpectBuilder +import ch.tutteli.atrium.logic.creating.RootExpectOptions import ch.tutteli.atrium.reporting.Reporter import ch.tutteli.atrium.reporting.translating.Locale import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable @@ -104,17 +105,23 @@ abstract class TranslatorIntSpec( prefixedDescribeTemplate(describePrefix, description, body) val reporterDeChFallbackFr = reporterFactory(Locale("de", "CH"), arrayOf(Locale("fr"))) + + @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) + @UseExperimental(ExperimentalNewExpectTypes::class) fun assertWithDeCh_Fr(subject: T) = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(AssertionVerb.ASSERT) - .withOptions(ExpectOptions(reporter = reporterDeChFallbackFr)) + .withOptions(RootExpectOptions(reporter = reporterDeChFallbackFr)) .build() val reporterDeChFallbackFrIt = reporterFactory(Locale("de", "CH"), arrayOf(Locale("fr", "CH"), Locale("it", "CH"))) + + @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) + @UseExperimental(ExperimentalNewExpectTypes::class) fun assertWithDeCh_Fr_It(subject: T) = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(AssertionVerb.ASSERT) - .withOptions(ExpectOptions(reporter = reporterDeChFallbackFrIt)) + .withOptions(RootExpectOptions(reporter = reporterDeChFallbackFrIt)) .build() val descriptionAnyAssertion = DescriptionAnyAssertion::class.simpleName @@ -272,9 +279,12 @@ abstract class TranslatorIntSpec( val locale = Locale("zh", country) val reporter = reporterFactory(locale, arrayOf()) - val assert = ExpectBuilder.forSubject(1) + + @Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) + @UseExperimental(ExperimentalNewExpectTypes::class) + val assert = RootExpectBuilder.forSubject(1) .withVerb(AssertionVerb.ASSERT) - .withOptions(ExpectOptions(reporter = reporter)) + .withOptions(RootExpectOptions(reporter = reporter)) .build() prefixedDescribe("primary locale is 'zh_$country' and no fallback defined") { diff --git a/misc/verbs-internal/atrium-verbs-internal-common/build.gradle b/misc/verbs-internal/atrium-verbs-internal-common/build.gradle index 4c37c9376..3dbed882c 100644 --- a/misc/verbs-internal/atrium-verbs-internal-common/build.gradle +++ b/misc/verbs-internal/atrium-verbs-internal-common/build.gradle @@ -2,8 +2,9 @@ description = 'Specifies the internally used assertion verbs as common module' dependencies { api prefixedProject('core-api-common') - api prefixedProject('domain-builders-common') + api prefixedProject('logic-common') + //TODO remove with 0.16.0 runtimeOnly prefixedProject('core-robstoll-common') testImplementation prefixedProject('specs-common') diff --git a/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt b/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt index cebb4ebcb..f4141df27 100644 --- a/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt +++ b/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt @@ -2,10 +2,11 @@ package ch.tutteli.atrium.api.verbs.internal import ch.tutteli.atrium.api.verbs.internal.AssertionVerb.EXPECT import ch.tutteli.atrium.assertions.Assertion +import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.creating.RootExpect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder import ch.tutteli.atrium.domain.builders.reporting.ReporterBuilder +import ch.tutteli.atrium.logic.creating.RootExpectBuilder import ch.tutteli.atrium.reporting.Reporter import ch.tutteli.atrium.reporting.ReporterFactory import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable @@ -18,8 +19,10 @@ import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable * @return The newly created assertion container. * @throws AssertionError in case an assertion does not hold. */ +@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */) +@UseExperimental(ExperimentalNewExpectTypes::class) fun expect(subject: T): RootExpect = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(EXPECT) .withoutOptions() .build() diff --git a/misc/verbs-internal/atrium-verbs-internal-js/build.gradle b/misc/verbs-internal/atrium-verbs-internal-js/build.gradle index 5ee2869e4..8d4d367b1 100644 --- a/misc/verbs-internal/atrium-verbs-internal-js/build.gradle +++ b/misc/verbs-internal/atrium-verbs-internal-js/build.gradle @@ -2,7 +2,7 @@ description = 'Specifies the internally used assertion verbs for the JS platform dependencies { api prefixedProject('core-api-js') - api prefixedProject('domain-builders-js') + api prefixedProject('logic-js') runtimeOnly prefixedProject('core-robstoll-js') diff --git a/misc/verbs-internal/atrium-verbs-internal-jvm/build.gradle b/misc/verbs-internal/atrium-verbs-internal-jvm/build.gradle index be9ce500e..8744a8684 100644 --- a/misc/verbs-internal/atrium-verbs-internal-jvm/build.gradle +++ b/misc/verbs-internal/atrium-verbs-internal-jvm/build.gradle @@ -1,8 +1,8 @@ description = 'Specifies the internally used assertion verbs' dependencies { - api prefixedProject('domain-builders-jvm') api prefixedProject('core-api-jvm') + api prefixedProject('logic-jvm') runtimeOnly prefixedProject('core-robstoll-jvm') diff --git a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt index 1aaead116..3277ff336 100644 --- a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt +++ b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt @@ -5,8 +5,8 @@ import ch.tutteli.atrium.assertions.Assertion import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.creating.FeatureExpect import ch.tutteli.atrium.creating.RootExpect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder import ch.tutteli.atrium.logic._logic +import ch.tutteli.atrium.logic.creating.RootExpectBuilder import ch.tutteli.atrium.logic.manualFeature /** @@ -18,7 +18,7 @@ import ch.tutteli.atrium.logic.manualFeature * @throws AssertionError in case an assertion does not hold. */ fun assert(subject: T): RootExpect = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(ASSERT) .withoutOptions() .build() diff --git a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt index b7640868c..df9c557f2 100644 --- a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt +++ b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt @@ -5,8 +5,8 @@ import ch.tutteli.atrium.assertions.Assertion import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.creating.FeatureExpect import ch.tutteli.atrium.creating.RootExpect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder import ch.tutteli.atrium.logic._logic +import ch.tutteli.atrium.logic.creating.RootExpectBuilder import ch.tutteli.atrium.logic.manualFeature /** @@ -18,7 +18,7 @@ import ch.tutteli.atrium.logic.manualFeature * @throws AssertionError in case an assertion does not hold. */ fun assertThat(subject: T): RootExpect = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(ASSERT_THAT) .withoutOptions() .build() diff --git a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt index 2c16bc4a6..c67754fba 100644 --- a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt +++ b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt @@ -5,8 +5,8 @@ import ch.tutteli.atrium.assertions.Assertion import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.creating.FeatureExpect import ch.tutteli.atrium.creating.RootExpect -import ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder import ch.tutteli.atrium.logic._logic +import ch.tutteli.atrium.logic.creating.RootExpectBuilder import ch.tutteli.atrium.logic.manualFeature /** @@ -18,7 +18,7 @@ import ch.tutteli.atrium.logic.manualFeature * @throws AssertionError in case an assertion does not hold. */ fun expect(subject: T): RootExpect = - ExpectBuilder.forSubject(subject) + RootExpectBuilder.forSubject(subject) .withVerb(EXPECT) .withoutOptions() .build() diff --git a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt index a0f3018ba..beebbd266 100644 --- a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt +++ b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt @@ -7,9 +7,9 @@ import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable * Contains the [DescriptiveAssertion.description]s of the assertion functions which are applicable to [Any]. */ enum class DescriptionFunLikeAssertion(override val value: String) : StringBasedTranslatable { - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWING_1("wirft"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWING_2("keine Exception bei Aufruf"), NO_EXCEPTION_OCCURRED("❗❗ keine Exception wurde geworfen"), THROWN_EXCEPTION_WHEN_CALLED("geworfene Exception bei Aufruf"), diff --git a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt index 21e7e5aa6..ebdcc5def 100644 --- a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt +++ b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt @@ -32,9 +32,9 @@ enum class DescriptionIterableAssertion(override val value: String) : StringBase INDEX_FROM_TO("Index %s..%s"), NUMBER_OF_OCCURRENCES("Anzahl Treffer"), SIZE_EXCEEDED("❗❗ hasNext() hat `false` zurückgegeben"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") CANNOT_EVALUATE_SUBJECT_EMPTY_ITERABLE("$COULD_NOT_EVALUATE_DEFINED_ASSERTIONS -- `Iterable` gibt keinen nächsten Eintrag zurück.\n$VISIT_COULD_NOT_EVALUATE_ASSERTIONS"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") CANNOT_EVALUATE_SUBJECT_ONLY_NULL("$COULD_NOT_EVALUATE_DEFINED_ASSERTIONS -- `Iterable` gibt nur `null` zurück.\n$VISIT_COULD_NOT_EVALUATE_ASSERTIONS"), WARNING_ADDITIONAL_ELEMENTS("zusätzliche Elemente entdeckt"), @Deprecated("Use WARNING_ADDITIONAL_ELEMENTS; will be removed latest with 1.0.0", ReplaceWith("WARNING_ADDITIONAL_ELEMENTS")) diff --git a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt index 4cfaad6be..30e3017d7 100644 --- a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt +++ b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt @@ -7,7 +7,7 @@ import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable * Contains the [DescriptiveAssertion.description]s of the assertion functions which are applicable to [Map]. */ enum class DescriptionListAssertion(override val value: String) : StringBasedTranslatable { - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") CANNOT_EVALUATE_INDEX_OUT_OF_BOUNDS("$COULD_NOT_EVALUATE_DEFINED_ASSERTIONS -- Index ausserhalb der Grenzen (index out of bounds).\n$VISIT_COULD_NOT_EVALUATE_ASSERTIONS"), INDEX_OUT_OF_BOUNDS("❗❗ Index ausserhalb der Grenzen (index out of bounds)") } diff --git a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionMapAssertion.kt b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionMapAssertion.kt index cab7bd71e..62eec5aea 100644 --- a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionMapAssertion.kt +++ b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionMapAssertion.kt @@ -11,7 +11,7 @@ import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable */ @Deprecated("Will be removed with latest with 1.0.0") enum class DescriptionMapAssertion(override val value: String) : StringBasedTranslatable { - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") CANNOT_EVALUATE_KEY_DOES_NOT_EXIST("$COULD_NOT_EVALUATE_DEFINED_ASSERTIONS -- der gegebene Key existiert nicht.\n$VISIT_COULD_NOT_EVALUATE_ASSERTIONS"), @Deprecated("Will be removed with latest with 1.0.0") diff --git a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt index 6b746cd9b..7b4e35258 100644 --- a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt +++ b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt @@ -12,7 +12,7 @@ enum class DescriptionThrowableAssertion(override val value: String) : StringBas ReplaceWith("ch.tutteli.atrium.translations.DescriptionAnyAssertion.IS_A") ) IS_A("ist eine"), - @Deprecated("Will be removed with 1.0.0", + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)", ReplaceWith("ch.tutteli.atrium.translations.DescriptionFunLikeAssertion.NO_EXCEPTION_OCCURRED") ) NO_EXCEPTION_OCCURRED("keine Exception wurde geworfen"), @@ -23,8 +23,8 @@ enum class DescriptionThrowableAssertion(override val value: String) : StringBas OCCURRED_EXCEPTION_MESSAGE("message"), OCCURRED_EXCEPTION_STACKTRACE("stacktrace"), OCCURRED_EXCEPTION_SUPPRESSED("suppressed"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWN_1("wird"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWN_2("nicht geworfen"), } diff --git a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt index b9dfc35ce..7ffa735f8 100644 --- a/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt +++ b/translations/de_CH/atrium-translations-de_CH-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt @@ -37,6 +37,6 @@ enum class ErrorMessages(override val value: String) : StringBasedTranslatable { HINT_AT_LEAST_ONE_ASSERTION_DEFINED("Sometimes you can use an alternative to `{ }` For instance, instead of `toThrow<..> { }` you should use `toThrow<..>()`"), // HINT_AT_LEAST_ONE_ASSERTION_DEFINED("Manchmal kann man eine Alternative zu `{ }` verwenden. Zum Beispiel, anstelle von `wirft<..> { }` sollten Sie `wirft<..>()` verwenden."), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") SUBJECT_ACCESSED_TOO_EARLY("Konnte die zusätzlichen Aussagen (Assertions) nicht auswerten; das Subjekt (subject) wurde zu früh verwendet. Bitte erfassen Sie einen Bug-Report unter $BUG_REPORT_URL inklusive Stacktrace wenn möglich -- vielen Dank."), } diff --git a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt index e1ee0d0ef..99134c88e 100644 --- a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt +++ b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionFunLikeAssertion.kt @@ -7,9 +7,9 @@ import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable * Contains the [DescriptiveAssertion.description]s of the assertion functions which are applicable to [Any]. */ enum class DescriptionFunLikeAssertion(override val value: String) : StringBasedTranslatable { - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWING_1("does not"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWING_2("throw when invoked"), NO_EXCEPTION_OCCURRED("❗❗ no exception occurred"), THROWN_EXCEPTION_WHEN_CALLED("thrown exception when called"), diff --git a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt index ce699a963..924bb7a90 100644 --- a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt +++ b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionIterableAssertion.kt @@ -32,9 +32,9 @@ enum class DescriptionIterableAssertion(override val value: String) : StringBase INDEX_FROM_TO("index %s..%s"), NUMBER_OF_OCCURRENCES("number of such entries"), SIZE_EXCEEDED("❗❗ hasNext() returned false"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") CANNOT_EVALUATE_SUBJECT_EMPTY_ITERABLE("$COULD_NOT_EVALUATE_DEFINED_ASSERTIONS -- `Iterable` has no next entry.\n$VISIT_COULD_NOT_EVALUATE_ASSERTIONS"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") CANNOT_EVALUATE_SUBJECT_ONLY_NULL("$COULD_NOT_EVALUATE_DEFINED_ASSERTIONS -- `Iterable` returns only `null` for `next()`.\n$VISIT_COULD_NOT_EVALUATE_ASSERTIONS"), WARNING_ADDITIONAL_ELEMENTS("additional elements detected"), @Deprecated("Use WARNING_ADDITIONAL_ELEMENTS; will be removed latest with 1.0.0", ReplaceWith("WARNING_ADDITIONAL_ELEMENTS")) diff --git a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt index ab5bc18e1..15601725a 100644 --- a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt +++ b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionListAssertion.kt @@ -7,7 +7,7 @@ import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable * Contains the [DescriptiveAssertion.description]s of the assertion functions which are applicable to [Map]. */ enum class DescriptionListAssertion(override val value: String) : StringBasedTranslatable { - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") CANNOT_EVALUATE_INDEX_OUT_OF_BOUNDS("$COULD_NOT_EVALUATE_DEFINED_ASSERTIONS -- index out of bounds.\n$VISIT_COULD_NOT_EVALUATE_ASSERTIONS"), INDEX_OUT_OF_BOUNDS("❗❗ index out of bounds") } diff --git a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt index 0b340d2c2..8a8a71445 100644 --- a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt +++ b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionThrowableAssertion.kt @@ -13,7 +13,7 @@ enum class DescriptionThrowableAssertion(override val value: String) : StringBas ) IS_A("is a"), @Deprecated( - "Will be removed with 1.0.0", + "Will be removed latest with 1.0.0 (maybe earlier)", ReplaceWith("ch.tutteli.atrium.translations.DescriptionFunLikeAssertion.NO_EXCEPTION_OCCURRED") ) NO_EXCEPTION_OCCURRED("no exception occurred"), @@ -24,8 +24,8 @@ enum class DescriptionThrowableAssertion(override val value: String) : StringBas OCCURRED_EXCEPTION_MESSAGE("message"), OCCURRED_EXCEPTION_STACKTRACE("stacktrace"), OCCURRED_EXCEPTION_SUPPRESSED("suppressed"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWN_1("is"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") IS_NOT_THROWN_2("not thrown at all"), } diff --git a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt index 339515c01..deef357cb 100644 --- a/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt +++ b/translations/en_GB/atrium-translations-en_GB-common/src/main/kotlin/ch/tutteli/atrium/translations/ErrorMessages.kt @@ -35,6 +35,6 @@ enum class ErrorMessages(override val value: String) : StringBasedTranslatable { ) HINT_AT_LEAST_ONE_ASSERTION_DEFINED("Sometimes you can use an alternative to `{ }` For instance, instead of `toThrow<..> { }` you should use `toThrow<..>()`"), - @Deprecated("Will be removed with 1.0.0") + @Deprecated("Will be removed latest with 1.0.0 (maybe earlier)") SUBJECT_ACCESSED_TOO_EARLY("Could not evaluate sub-assertions; the subject was accessed too early. Please report a bug at $BUG_REPORT_URL including stacktrace if possible -- thank you"), }