From 81216138eceb22b808c2b514aa0c270d908ab343 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Mon, 5 Apr 2021 21:03:07 +0200 Subject: [PATCH 1/5] deprecate CoreFactory and loadService --- .../assertions/BulletPointIdentifier.kt | 4 +- .../assertions/FeatureAssertionGroupType.kt | 3 +- .../assertions/SummaryAssertionGroupType.kt | 5 --- .../ch/tutteli/atrium/core/CoreFactory.kt | 45 ++++++++++--------- .../atrium/core/polyfills/loadService.kt | 7 +-- .../atrium/creating/AssertionContainer.kt | 2 +- .../atrium/creating/SubjectProvider.kt | 2 +- .../reporting/AssertionFormatterController.kt | 4 +- .../reporting/AssertionFormatterFacade.kt | 4 +- .../ch/tutteli/atrium/reporting/Reporter.kt | 3 -- .../ch/tutteli/atrium/core/CoreFactory.kt | 4 ++ .../atrium/core/polyfills/loadServices.kt | 8 +++- .../ch/tutteli/atrium/core/CoreFactory.kt | 7 +-- .../atrium/core/polyfills/loadServices.kt | 5 ++- .../impl/DefaultMapLikeContainsAssertions.kt | 1 - .../logic/impl/DefaultFeatureAssertions.kt | 1 - .../reporting/AssertionFormatterSpecBase.kt | 1 - ...meAndSubjectAssertionGroupFormatterSpec.kt | 1 - .../SingleAssertionGroupTypeFormatterSpec.kt | 1 - 19 files changed, 53 insertions(+), 55 deletions(-) diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/BulletPointIdentifier.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/BulletPointIdentifier.kt index 150de1b2de..3f818232df 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/BulletPointIdentifier.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/BulletPointIdentifier.kt @@ -1,9 +1,7 @@ package ch.tutteli.atrium.assertions -import ch.tutteli.atrium.core.CoreFactory /** - * A marker interface for types which can be used to identify bullet points in - * [CoreFactory.registerTextAssertionFormatterCapabilities]. + * A marker interface for types which can be used to identify bullet points. */ interface BulletPointIdentifier diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/FeatureAssertionGroupType.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/FeatureAssertionGroupType.kt index f201e86e47..62b16fbff4 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/FeatureAssertionGroupType.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/FeatureAssertionGroupType.kt @@ -1,6 +1,5 @@ package ch.tutteli.atrium.assertions -import ch.tutteli.atrium.core.CoreFactory /** * Represents the [AssertionGroupType] for [AssertionGroup]s which contain some kind of feature assertions. @@ -8,7 +7,7 @@ import ch.tutteli.atrium.core.CoreFactory interface FeatureAssertionGroupType : AssertionGroupType /** - * This class is only used as identifier for [CoreFactory.registerTextAssertionFormatterCapabilities]. + * This class is only used as [BulletPointIdentifier]. */ class PrefixFeatureAssertionGroupHeader private constructor() : BulletPointIdentifier diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/SummaryAssertionGroupType.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/SummaryAssertionGroupType.kt index b8d2ee41d6..f0ce467f99 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/SummaryAssertionGroupType.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/SummaryAssertionGroupType.kt @@ -1,6 +1,5 @@ package ch.tutteli.atrium.assertions -import ch.tutteli.atrium.core.CoreFactory import ch.tutteli.atrium.reporting.AssertionFormatter import ch.tutteli.atrium.reporting.Reporter @@ -20,16 +19,12 @@ interface SummaryAssertionGroupType : DoNotFilterAssertionGroupType /** * Represents the identifier for bullet points used to prefix [Assertion]s which hold, in context of an * [AssertionGroup] with type [SummaryAssertionGroupType]. - * - * See also [CoreFactory.registerTextAssertionFormatterCapabilities]. */ class PrefixSuccessfulSummaryAssertion private constructor() : BulletPointIdentifier /** * Represents the identifier for bullet points used to prefix [Assertion]s which do not hold, in context of an * [AssertionGroup] with type [SummaryAssertionGroupType]. - * - * See also [CoreFactory.registerTextAssertionFormatterCapabilities]. */ class PrefixFailingSummaryAssertion private constructor() : BulletPointIdentifier diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt index 321db53bcc..69d680527c 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt @@ -1,3 +1,6 @@ +//TODO remove file with 0.18.0 +@file:Suppress("DEPRECATION") + package ch.tutteli.atrium.core import ch.tutteli.atrium.assertions.* @@ -19,7 +22,7 @@ annotation class ExperimentalNewExpectTypes * * It loads the implementation lazily via [loadSingleService]. */ -//TODO 0.17.0 deprecate +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") val coreFactory by lazy { loadSingleService(CoreFactory::class) } /** @@ -31,7 +34,7 @@ val coreFactory by lazy { loadSingleService(CoreFactory::class) } * Notice, the platform specific types have to define the default methods for `newReportingPlantNullable` * (otherwise we are not binary backward compatible) -> will be moved to CoreFactoryCommon with 1.0.0 */ -//TODO 0.17.0 deprecate +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") expect interface CoreFactory : CoreFactoryCommon /** @@ -52,7 +55,7 @@ expect interface CoreFactory : CoreFactoryCommon * - [Reporter] * - [AtriumErrorAdjuster] */ -//TODO 0.17.0 deprecate +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") interface CoreFactoryCommon { /** @@ -64,7 +67,7 @@ interface CoreFactoryCommon { * * @return The newly created method call formatter. */ - @Deprecated("Create a new MethodCallFormatter via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.17.0") + @Deprecated("Create a new MethodCallFormatter via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.18.0") fun newMethodCallFormatter(): MethodCallFormatter @@ -91,7 +94,7 @@ interface CoreFactoryCommon { * @throws IllegalArgumentException in case [primaryLocale] or [fallbackLocales] have as language `no` or if they * have: as language `zh`, country is not set and script is either `Hant` or `Hans`. */ - @Deprecated("Create a new Translator via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.17.0") + @Deprecated("Create a new Translator via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.18.0") fun newTranslator( translationSupplier: TranslationSupplier, localeOrderDecider: LocaleOrderDecider, @@ -108,7 +111,7 @@ interface CoreFactoryCommon { * * @return The newly created [Locale] order decider. */ - @Deprecated("Create a new LocaleOrderDecider via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.17.0") + @Deprecated("Create a new LocaleOrderDecider via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.18.0") fun newLocaleOrderDecider(): LocaleOrderDecider /** @@ -117,7 +120,7 @@ interface CoreFactoryCommon { * * @return The newly created object formatter. */ - @Deprecated("Create a new ObjectFormatter via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.17.0") + @Deprecated("Create a new ObjectFormatter via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.18.0") fun newDetailedObjectFormatter(translator: Translator): ObjectFormatter /** @@ -125,7 +128,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter controller. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun newAssertionFormatterController(): AssertionFormatterController /** @@ -135,7 +138,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter facade. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun newAssertionFormatterFacade(assertionFormatterController: AssertionFormatterController): AssertionFormatterFacade /** @@ -154,7 +157,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter. */ - @Deprecated("Create it via TextAssertionPairFormatter.newSameLine(...); will be removed with 0.17.0") + @Deprecated("Create it via TextAssertionPairFormatter.newSameLine(...); will be removed with 0.18.0") fun newTextSameLineAssertionPairFormatter( objectFormatter: ObjectFormatter, translator: Translator @@ -178,7 +181,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter. */ - @Deprecated("Create it via TextAssertionPairFormatter.newNextLine(...); will be removed with 0.17.0") + @Deprecated("Create it via TextAssertionPairFormatter.newNextLine(...); will be removed with 0.18.0") fun newTextNextLineAssertionPairFormatter( objectFormatter: ObjectFormatter, translator: Translator @@ -199,7 +202,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun newTextFallbackAssertionFormatter( bulletPoints: Map, String>, assertionFormatterController: AssertionFormatterController, @@ -221,7 +224,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun newTextFeatureAssertionGroupFormatter( bulletPoints: Map, String>, assertionFormatterController: AssertionFormatterController, @@ -242,7 +245,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun newTextListAssertionGroupFormatter( bulletPoints: Map, String>, assertionFormatterController: AssertionFormatterController, @@ -264,7 +267,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun newTextSummaryAssertionGroupFormatter( bulletPoints: Map, String>, assertionFormatterController: AssertionFormatterController, @@ -284,7 +287,7 @@ interface CoreFactoryCommon { * * @return The newly created assertion formatter. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun newTextExplanatoryAssertionGroupFormatter( bulletPoints: Map, String>, assertionFormatterController: AssertionFormatterController @@ -305,7 +308,7 @@ interface CoreFactoryCommon { * @param objectFormatter The formatter which is used to format objects other than [Assertion]s. * @param translator The translator which is used to translate [Translatable] such as [DescriptiveAssertion.description]. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; will be removed with 0.18.0") fun registerTextAssertionFormatterCapabilities( bulletPoints: Map, String>, assertionFormatterFacade: AssertionFormatterFacade, @@ -333,7 +336,7 @@ interface CoreFactoryCommon { * @return The newly created adjuster. */ @Deprecated( - "Use NoOpAtriumErrorAdjuster instead; will be removed with 0.17.0", + "Use NoOpAtriumErrorAdjuster instead; will be removed with 0.18.0", ReplaceWith("ch.tutteli.atrium.reporting.erroradjusters.NoOpAtriumErrorAdjuster") ) fun newNoOpAtriumErrorAdjuster(): AtriumErrorAdjuster @@ -343,7 +346,7 @@ interface CoreFactoryCommon { * * @return The newly created adjuster. */ - @Deprecated("Create a new RemoveRunnerFromAtriumError via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.17.0") + @Deprecated("Create a new RemoveRunnerFromAtriumError via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.18.0") fun newRemoveRunnerAtriumErrorAdjuster(): AtriumErrorAdjuster /** @@ -351,7 +354,7 @@ interface CoreFactoryCommon { * * @return The newly created adjuster. */ - @Deprecated("Create a new RemoveAtriumFromAtriumError via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.17.0") + @Deprecated("Create a new RemoveAtriumFromAtriumError via the ComponentFactoryContainer, e.g. via _logic.components.build(); will be removed with 0.18.0") fun newRemoveAtriumFromAtriumErrorAdjuster(): AtriumErrorAdjuster /** @@ -365,7 +368,7 @@ interface CoreFactoryCommon { * @return The newly created adjuster. */ @Deprecated( - "Use MultiAtriumErrorAdjuster instead; will be removed with 0.17.0", + "Use MultiAtriumErrorAdjuster instead; will be removed with 0.18.0", ReplaceWith( "MultiAtriumErrorAdjuster(firstAdjuster, secondAdjuster, otherAdjusters)", "ch.tutteli.atrium.reporting.erroradjusters.MultiAtriumErrorAdjuster" diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadService.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadService.kt index 57e58ea83b..a72d33b461 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadService.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadService.kt @@ -1,3 +1,4 @@ +//TODO remove file with 0.18.0 package ch.tutteli.atrium.core.polyfills import ch.tutteli.kbox.forEachRemaining @@ -11,7 +12,7 @@ import kotlin.reflect.KClass * @throws NoSuchElementException in case there is no service found for [kClass]. * @throws IllegalStateException in case there is more than one service found for [kClass]. */ -//TODO 0.17.0 deprecate +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") expect fun loadSingleService(kClass: KClass): T /** @@ -19,7 +20,7 @@ expect fun loadSingleService(kClass: KClass): T * * @return The loaded services as a [Sequence]. */ -//TODO 0.17.0 deprecate +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") expect fun loadServices(kClass: KClass): Sequence /** @@ -28,7 +29,7 @@ expect fun loadServices(kClass: KClass): Sequence * @throws NoSuchElementException in case there is no service found for [kClass]. * @throws IllegalStateException in case there is more than one service found for [kClass]. */ -//TODO 0.17.0 deprecate +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") fun useSingleService(kClass: KClass, itr: Iterator): T { if (!itr.hasNext()) throw NoSuchElementException("Could not find any implementation for ${kClass.fullName}") 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 7227509f4f..381eb1c208 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 @@ -32,7 +32,7 @@ interface AssertionContainer : @kotlin.Suppress("DEPRECATION") SubjectProvide * * Might be we completely remove it without prior notice. */ - //TODO 0.17.0/0.18.0 maybe it would be better to have proofFactories as val like we have components? + //TODO 0.18.0/0.19.0 maybe it would be better to have proofFactories as val like we have components? @ExperimentalNewExpectTypes fun getImpl(kClass: KClass, defaultFactory: () -> I): I diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/SubjectProvider.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/SubjectProvider.kt index 8ca170402a..df5f555664 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/SubjectProvider.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/creating/SubjectProvider.kt @@ -10,7 +10,7 @@ import ch.tutteli.atrium.core.Some * Provides the subject of an [Assertion]. * * Notice, this interface had its mere purpose to facilitate the transition from `Assert` to [Expect] -- `Assert` was - * removed in 0.16.0 and thus this interface will be removed with 0.17.0. + * removed in 0.16.0 and thus this interface will be removed with 0.18.0. */ @Suppress("DEPRECATION") @Deprecated("Will be removed with 0.18.0 without replacement, switch to Expect or AssertionContainer") diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt index 54058cf714..b1aa7c02c3 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt @@ -4,7 +4,6 @@ import ch.tutteli.atrium.assertions.Assertion import ch.tutteli.atrium.assertions.AssertionGroup import ch.tutteli.atrium.assertions.ExplanatoryAssertionGroupType import ch.tutteli.atrium.assertions.InvisibleAssertionGroupType -import ch.tutteli.atrium.core.CoreFactory /** * Responsible to control the flow of reporting using [register]ed [AssertionFormatter]s. @@ -16,8 +15,7 @@ interface AssertionFormatterController { * formats it. * * The [parameterObject] allows to define an [assertionFilter][AssertionFormatterParameterObject.assertionFilter] - * to filter out [Assertion]s (for instance, filter out messages which hold - * → see [CoreFactory.newOnlyFailureReporter]). + * to filter out [Assertion]s (for instance, filter out messages which hold. * Moreover the controller should take into account whether the control flow * [AssertionFormatterParameterObject.isNotInDoNotFilterGroup] or is in such a group, * in which case the filtering should not apply. diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterFacade.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterFacade.kt index 16febb04c0..91c63525ad 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterFacade.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterFacade.kt @@ -1,7 +1,6 @@ package ch.tutteli.atrium.reporting import ch.tutteli.atrium.assertions.Assertion -import ch.tutteli.atrium.core.CoreFactory /** * Responsible to call an appropriate [AssertionFormatter] which supports [format]ing a given [Assertion]. @@ -11,8 +10,7 @@ interface AssertionFormatterFacade { /** * Formats the given [assertion] and appends the result to the given [sb]. * - * One can define an [assertionFilter] to filter out [Assertion]s - * (for instance, filter out assertions which hold → see [CoreFactory.newOnlyFailureReporter]). + * One can define an [assertionFilter] to filter out [Assertion]s. * * @param sb The [StringBuilder] to which the formatted [assertion] will be appended. * @param assertion The assertion which should be formatted diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/Reporter.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/Reporter.kt index cd44e48240..a2129e2271 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/Reporter.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/Reporter.kt @@ -1,7 +1,6 @@ package ch.tutteli.atrium.reporting import ch.tutteli.atrium.assertions.Assertion -import ch.tutteli.atrium.core.CoreFactory /** * Represents a reporter which reports about [Assertion]s. @@ -12,8 +11,6 @@ interface Reporter { * Reports about the given [assertion], using the given [sb] where the actual * implementation will decide whether the given [assertion] is noteworthy to be reported. * - * For instance, [CoreFactory.newOnlyFailureReporter] will only report failing [Assertion]s. - * * @param sb The [StringBuilder] which can be used for reporting. * @param assertion The assertion which should be considered for reporting. */ diff --git a/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt b/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt index 45f3b756e7..99109ed054 100644 --- a/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt +++ b/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt @@ -1,3 +1,7 @@ +//TODO remove file with 0.18.0 +@file:Suppress("DEPRECATION") + package ch.tutteli.atrium.core +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") actual interface CoreFactory : CoreFactoryCommon diff --git a/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt b/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt index 99b3880367..2546516404 100644 --- a/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt +++ b/core/api/atrium-core-api-js/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt @@ -1,13 +1,17 @@ +//TODO remove file with 0.18.0 +@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith") + package ch.tutteli.atrium.core.polyfills import kotlin.reflect.KClass private val serviceRegistry = mutableMapOf, HashSet>() +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") actual fun loadSingleService(kClass: KClass): T = useSingleService(kClass, loadServices(kClass).iterator()) - +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") actual fun loadServices(kClass: KClass): Sequence { @Suppress("UNCHECKED_CAST" /* we have a homogeneous map but make sure insertions are type safe, thus OK */) val set = serviceRegistry[kClass] as Set<() -> T>? @@ -17,11 +21,13 @@ actual fun loadServices(kClass: KClass): Sequence { /** * Registers the given [service] for the service of type [T]. */ +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") inline fun registerService(noinline service: () -> T) = registerService(T::class, service) /** * Registers the given [service] for the given [serviceInterface]. */ +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") fun registerService(serviceInterface: KClass, service: () -> T) { val services = serviceRegistry.getOrPut(serviceInterface) { hashSetOf() } services.add(service) diff --git a/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt b/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt index e6ab824c86..cbb98440d7 100644 --- a/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt +++ b/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/CoreFactory.kt @@ -1,6 +1,7 @@ +//TODO remove file with 0.18.0 @file:Suppress( // TODO remove once https://youtrack.jetbrains.com/issue/KT-35343 is fixed - "JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE" + "JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE", "DEPRECATION" ) package ch.tutteli.atrium.core @@ -11,7 +12,7 @@ import ch.tutteli.atrium.reporting.translating.Locale import ch.tutteli.atrium.reporting.translating.TranslationSupplier import java.util.* -//TODO 0.17.0 deprecate +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") actual interface CoreFactory : CoreFactoryCommon { /** @@ -27,7 +28,7 @@ actual interface CoreFactory : CoreFactoryCommon { * * @return The newly created translation supplier. */ - @Deprecated("Open an issue in case you used this; Will be removed with 0.17.0") + @Deprecated("Open an issue in case you used this; Will be removed with 0.18.0") fun newPropertiesBasedTranslationSupplier(): TranslationSupplier @Deprecated( diff --git a/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt b/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt index bcce3f146f..c4acfe7c50 100644 --- a/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt +++ b/core/api/atrium-core-api-jvm/src/main/kotlin/ch/tutteli/atrium/core/polyfills/loadServices.kt @@ -1,6 +1,7 @@ +//TODO remove file with 0.18.0 @file:Suppress( // TODO remove once https://youtrack.jetbrains.com/issue/KT-35343 is fixed - "JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE" + "JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE", "DEPRECATION", "DeprecatedCallableAddReplaceWith" ) package ch.tutteli.atrium.core.polyfills @@ -17,8 +18,10 @@ import kotlin.reflect.KClass * @throws NoSuchElementException in case there is no service found for [kClass]. * @throws IllegalStateException in case there is more than one service found for [kClass]. */ +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") actual fun loadSingleService(kClass: KClass): T = useSingleService(kClass, ServiceLoader.load(kClass.java).iterator()) +@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0") actual fun loadServices(kClass: KClass): Sequence = ServiceLoader.load(kClass.java).asSequence() diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/maplike/contains/creators/impl/DefaultMapLikeContainsAssertions.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/maplike/contains/creators/impl/DefaultMapLikeContainsAssertions.kt index 1690596f8f..70cbc68a1c 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/maplike/contains/creators/impl/DefaultMapLikeContainsAssertions.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/maplike/contains/creators/impl/DefaultMapLikeContainsAssertions.kt @@ -5,7 +5,6 @@ import ch.tutteli.atrium.assertions.builders.assertionBuilder import ch.tutteli.atrium.assertions.builders.invisibleGroup import ch.tutteli.atrium.core.Option import ch.tutteli.atrium.core.Some -import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.creating.ExperimentalComponentFactoryContainer import ch.tutteli.atrium.creating.build diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultFeatureAssertions.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultFeatureAssertions.kt index 385ed58627..4b3a5fece5 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultFeatureAssertions.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultFeatureAssertions.kt @@ -2,7 +2,6 @@ package ch.tutteli.atrium.logic.impl import ch.tutteli.atrium.core.ExperimentalNewExpectTypes import ch.tutteli.atrium.core.Some -import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.creating.AssertionContainer import ch.tutteli.atrium.creating.ExperimentalComponentFactoryContainer import ch.tutteli.atrium.creating.build diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterSpecBase.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterSpecBase.kt index f3556e3732..c2a5df48ea 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterSpecBase.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterSpecBase.kt @@ -1,7 +1,6 @@ package ch.tutteli.atrium.specs.reporting import ch.tutteli.atrium.assertions.* -import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.reporting.* import ch.tutteli.atrium.reporting.impl.AssertionFormatterControllerBasedFacade import ch.tutteli.atrium.reporting.impl.DefaultAssertionFormatterController diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/EmptyNameAndSubjectAssertionGroupFormatterSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/EmptyNameAndSubjectAssertionGroupFormatterSpec.kt index a3a02f0320..8472f28459 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/EmptyNameAndSubjectAssertionGroupFormatterSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/EmptyNameAndSubjectAssertionGroupFormatterSpec.kt @@ -6,7 +6,6 @@ import ch.tutteli.atrium.api.verbs.internal.expect import ch.tutteli.atrium.assertions.AssertionGroup import ch.tutteli.atrium.assertions.AssertionGroupType import ch.tutteli.atrium.assertions.builders.assertionBuilder -import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.reporting.AssertionFormatter import ch.tutteli.atrium.reporting.AssertionFormatterController import ch.tutteli.atrium.reporting.AssertionFormatterParameterObject diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/SingleAssertionGroupTypeFormatterSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/SingleAssertionGroupTypeFormatterSpec.kt index daee3319e6..69d6c02acf 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/SingleAssertionGroupTypeFormatterSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/SingleAssertionGroupTypeFormatterSpec.kt @@ -10,7 +10,6 @@ import ch.tutteli.atrium.assertions.AssertionGroup import ch.tutteli.atrium.assertions.AssertionGroupType import ch.tutteli.atrium.assertions.BulletPointIdentifier import ch.tutteli.atrium.assertions.builders.assertionBuilder -import ch.tutteli.atrium.core.coreFactory import ch.tutteli.atrium.core.polyfills.fullName import ch.tutteli.atrium.reporting.AssertionFormatter import ch.tutteli.atrium.reporting.AssertionFormatterController From 54aaefa846506675ebc7adec5b102ef6aa6168a3 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Mon, 5 Apr 2021 21:03:55 +0200 Subject: [PATCH 2/5] remove MethodCallFormatter.format --- .../tutteli/atrium/reporting/MethodCallFormatter.kt | 13 ------------- .../text/impl/DefaultTextMethodCallFormatter.kt | 4 ---- 2 files changed, 17 deletions(-) diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/MethodCallFormatter.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/MethodCallFormatter.kt index a78ca4beeb..166c132108 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/MethodCallFormatter.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/MethodCallFormatter.kt @@ -4,18 +4,6 @@ package ch.tutteli.atrium.reporting * Responsible to format a method call in reporting. */ interface MethodCallFormatter { - - /** - * Returns a lazy representation of the method call to a method named [methodName] with the given [arguments]. - * - * @param methodName The name of the method for which a call with the given [arguments] should be formatted. - * @param arguments The arguments of the method call. - * - * @return An lambda containing the logic to build the representation. - */ - @Deprecated("Use the overload which returns a string right away, wrap it into a lambda on your own if you need this functionality; will be removed with 0.17.0") - fun format(methodName: String, arguments: Array): () -> String - /** * Returns a representation of a method call to a method named [methodName] with the given [arguments]. * @@ -26,7 +14,6 @@ interface MethodCallFormatter { */ fun formatCall(methodName: String, arguments: Array): String - /** * Formats the given [argument]. */ diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextMethodCallFormatter.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextMethodCallFormatter.kt index a417d8f34f..ab38d9f5a8 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextMethodCallFormatter.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextMethodCallFormatter.kt @@ -15,10 +15,6 @@ object DefaultTextMethodCallFormatter : TextMethodCallFormatter { override fun formatCall(methodName: String, arguments: Array): String = arguments.joinToString(", ", prefix = "$methodName(", postfix = ")") { formatArgument(it) } - override fun format(methodName: String, arguments: Array): () -> String = { - formatCall(methodName, arguments) - } - override fun formatArgument(argument: Any?): String = when (argument) { null -> Text.NULL.string is CharSequence -> "\"$argument\"".replace("\r", "\\r").replace("\n", "\\n") From 924106a968cb9d4600178eded3512cc5b184297e Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Mon, 5 Apr 2021 21:06:25 +0200 Subject: [PATCH 3/5] remove RawString and sub types --- .../ch/tutteli/atrium/reporting/RawString.kt | 42 ------------------- .../atrium/reporting/StringBasedRawString.kt | 24 ----------- .../text/impl/DefaultTextObjectFormatter.kt | 4 -- .../TextNextLineAssertionPairFormatter.kt | 3 +- .../translating/TranslatableBasedRawString.kt | 30 ------------- .../specs/reporting/ObjectFormatterSpec.kt | 18 -------- misc/tools/bc-tests/build.gradle.kts | 35 +++++++++++++++- 7 files changed, 35 insertions(+), 121 deletions(-) delete mode 100644 core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/RawString.kt delete mode 100644 core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/StringBasedRawString.kt delete mode 100644 core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/TranslatableBasedRawString.kt diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/RawString.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/RawString.kt deleted file mode 100644 index 3624908590..0000000000 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/RawString.kt +++ /dev/null @@ -1,42 +0,0 @@ -@file:Suppress(/* TODO remove file with 1.0.0 */"DEPRECATION") - -package ch.tutteli.atrium.reporting - -import ch.tutteli.atrium.reporting.translating.Translatable -import ch.tutteli.atrium.reporting.translating.TranslatableBasedRawString - -/** - * Marker interface for types which provide a raw string functionality - * and should be treated accordingly in reporting (e.g., in [ObjectFormatter]). - */ -@Deprecated("Use Text instead; will be removed with 0.17.0", ReplaceWith("Text")) -interface RawString { - companion object { - /** - * The representation for `null` as [StringBasedRawString]. - */ - @Deprecated( - "use Text.NULL instead; will be removed with 0.17.0", - ReplaceWith("Text.NULL", "ch.tutteli.atrium.reporting.Text") - ) - val NULL = StringBasedRawString("null") - - /** - * An empty string as [RawString]. - */ - @Deprecated( - "use Text.EMPTY instead; will be removed with 0.17.0", - ReplaceWith("Text.EMPTY", "ch.tutteli.atrium.reporting.Text") - ) - val EMPTY = StringBasedRawString("") - - @Deprecated( - "Use Text.create instead; will be removed with 0.17.0", - ReplaceWith("Text(string)", "ch.tutteli.atrium.reporting.Text") - ) - fun create(string: String): RawString = StringBasedRawString(string) - - @Deprecated("Translatable are always treated as Text since 0.13.0", ReplaceWith("translatable")) - fun create(translatable: Translatable): RawString = TranslatableBasedRawString(translatable) - } -} diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/StringBasedRawString.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/StringBasedRawString.kt deleted file mode 100644 index bb704866b2..0000000000 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/StringBasedRawString.kt +++ /dev/null @@ -1,24 +0,0 @@ -//TODO remove file with 1.0.0 -@file:Suppress("DEPRECATION") - -package ch.tutteli.atrium.reporting - -/** - * Use this class to represent a [String] which should be treated as raw [String] in reporting. - * @see ObjectFormatter - * - * @property string The string which should be treated as raw [String]. - * - * @constructor Use [RawString.create] to create a [String] based [RawString]. - * @param string The string which should be treated as raw [String]. - */ -@Deprecated("Switch from StringBasedRawString to Text; will be removed with 0.17.0", ReplaceWith("Text(string)")) -data class StringBasedRawString internal constructor(val string: String) : RawString { - - /** - * @suppress No need to document this behaviour. - */ - override fun toString(): String { - return "$string (RawString)" - } -} diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextObjectFormatter.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextObjectFormatter.kt index 4ca1bad45c..4d86eac790 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextObjectFormatter.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/DefaultTextObjectFormatter.kt @@ -53,10 +53,6 @@ abstract class TextObjectFormatterCommon( is KClass<*> -> format(value) is Enum<*> -> format(value) is Throwable -> format(value) - //TODO remove with 1.0.0 - is StringBasedRawString -> limitRepresentation(value.string) - is ch.tutteli.atrium.reporting.translating.TranslatableBasedRawString -> limitRepresentation(translator.translate(value.translatable)) - else -> limitRepresentation(value.toString()) + classNameAndIdentity(value) } diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextNextLineAssertionPairFormatter.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextNextLineAssertionPairFormatter.kt index 5db44b2ef3..119cffa640 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextNextLineAssertionPairFormatter.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextNextLineAssertionPairFormatter.kt @@ -48,11 +48,10 @@ class TextNextLineAssertionPairFormatter( ) { parameterObject.sb.append(translator.translate(translatable)).append(":") - @Suppress(/* TODO remove RawString.Empty with 1.0.0*/ "DEPRECATION") // yes, we check only for Text.EMPTY and not for `representation !is Text || representation.string != ""` // on purpose. You can only create an empty Text via a hack and not via the normal invoke function in // the companion of Text - if (representation != Text.EMPTY && representation != RawString.EMPTY) { + if (representation != Text.EMPTY) { newParameterObject.appendLnAndIndent() newParameterObject.indent(newParameterObject.prefix.length) parameterObject.sb.append(objectFormatter.format(representation)) diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/TranslatableBasedRawString.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/TranslatableBasedRawString.kt deleted file mode 100644 index a743139465..0000000000 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/TranslatableBasedRawString.kt +++ /dev/null @@ -1,30 +0,0 @@ -//TODO remove file with 1.0.0 -@file:Suppress("DEPRECATION") - -package ch.tutteli.atrium.reporting.translating - -import ch.tutteli.atrium.reporting.ObjectFormatter -import ch.tutteli.atrium.reporting.RawString - -/** - * Use this class to represent a [Translatable] which shall be translated and - * then be treated as raw [String] in reporting. - * - * @see ObjectFormatter - * - * @property translatable The [Translatable] who's translation should be treated as raw [String]. - * - * @constructor Use [RawString.create] to create a [Translatable] based [RawString]. - * @param translatable The [Translatable] who's translation should be treated as raw [String]. - * - */ -@Deprecated("This wrapper is no longer required, we treat Translatable special in DetailedObjectFormatter; will be removed latest with 1.0.0") -data class TranslatableBasedRawString internal constructor(val translatable: Translatable) : RawString { - - /** - * @suppress No need to document this behaviour. - */ - override fun toString(): String { - return "${translatable.getDefault()} (TranslatableRawString)" - } -} diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/ObjectFormatterSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/ObjectFormatterSpec.kt index 60845960de..1329b1ba6d 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/ObjectFormatterSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/ObjectFormatterSpec.kt @@ -50,23 +50,5 @@ abstract class ObjectFormatterSpec( expect(result).isSameAs(translatedText) } } - - //TODO remove with 1.0.0 - @Suppress("DEPRECATION") - context("a ${ch.tutteli.atrium.reporting.StringBasedRawString::class.simpleName}") { - val result = testee.format(Text("hello")) - it("returns the containing string") { - expect(result).toBe("hello") - } - } - - //TODO remove with 1.0.0 - @Suppress("DEPRECATION") - context("a ${ch.tutteli.atrium.reporting.translating.TranslatableBasedRawString::class.simpleName}") { - val result = testee.format(ch.tutteli.atrium.api.verbs.internal.AssertionVerb.EXPECT) - it("returns the translated string") { - expect(result).isSameAs(translatedText) - } - } } }) diff --git a/misc/tools/bc-tests/build.gradle.kts b/misc/tools/bc-tests/build.gradle.kts index 9616a9b769..403bf18918 100644 --- a/misc/tools/bc-tests/build.gradle.kts +++ b/misc/tools/bc-tests/build.gradle.kts @@ -88,6 +88,7 @@ fun Project.defineSourceFix(target: String, fix: () -> Unit) { map[target] = fix } } + fun Project.getSrcFixes() = @Suppress("UNCHECKED_CAST") (project.extra[fixSrcPropertyName] as MutableMap Unit>) @@ -767,7 +768,8 @@ listOf("0.14.0", "0.15.0").forEach { version -> targetDir.resolve("META-INF") ) } - listOf("src/jvmTest/kotlin/ch/tutteli/atrium/api/infix/en_GB/BigDecimalAssertionsSpec.kt", + listOf( + "src/jvmTest/kotlin/ch/tutteli/atrium/api/infix/en_GB/BigDecimalAssertionsSpec.kt", "src/jvmTest/kotlin/ch/tutteli/atrium/api/infix/en_GB/ChronoLocalDateAssertionsSpec.kt", "src/jvmTest/kotlin/ch/tutteli/atrium/api/infix/en_GB/ChronoLocalDateTimeAssertionSpec.kt", "src/jvmTest/kotlin/ch/tutteli/atrium/api/infix/en_GB/ChronoZonedDateTimeAssertionSpec.kt", @@ -887,6 +889,37 @@ with(project(":bc-tests:0.15.0-api-infix-en_GB")) { } } + +// we removed RawString and co in 0.17.0 +listOf("0.14.0", "0.15.0", "0.16.0").forEach { version -> + with(project(":bc-tests:$version-specs")) { + defineSourceFix("common") { + rewriteFile("src/commonMain/kotlin/main/kotlin/ch/tutteli/atrium/specs/reporting/ObjectFormatterSpec.kt") { + it.replaceFirst( + "//TODO remove with 1.0.0\n" + + " @Suppress(\"DEPRECATION\")\n" + + " context(\"a \${ch.tutteli.atrium.reporting.StringBasedRawString::class.simpleName}\") {\n" + + " val result = testee.format(Text(\"hello\"))\n" + + " it(\"returns the containing string\") {\n" + + " expect(result).toBe(\"hello\")\n" + + " }\n" + + " }\n" + + "\n" + + " //TODO remove with 1.0.0\n" + + " @Suppress(\"DEPRECATION\")\n" + + " context(\"a \${ch.tutteli.atrium.reporting.translating.TranslatableBasedRawString::class.simpleName}\") {\n" + + " val result = testee.format(ch.tutteli.atrium.api.verbs.internal.AssertionVerb.EXPECT)\n" + + " it(\"returns the translated string\") {\n" + + " expect(result).isSameAs(translatedText)\n" + + " }\n" + + " }", "" + ) + } + } + } +} + + // TODO 0.18.0 remove once we support js again listOf("0.14.0", "0.15.0", "0.16.0").forEach { version -> listOf("fluent", "infix").forEach { apiShortName -> From 275397109b7fb421c165c8fd7addde1fd1339025 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Mon, 5 Apr 2021 21:08:40 +0200 Subject: [PATCH 4/5] remove deprecated constructor from Untranslatable --- .../atrium/reporting/translating/Untranslatable.kt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/Untranslatable.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/Untranslatable.kt index ef7d65af3a..35b8b3e60f 100644 --- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/Untranslatable.kt +++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/reporting/translating/Untranslatable.kt @@ -8,14 +8,6 @@ package ch.tutteli.atrium.reporting.translating * @param representation A representation which is not intended to be translated. */ class Untranslatable(representation: String) : Translatable { - - @Suppress("DEPRECATION") - @Deprecated("Use the overload which expects String; will be removed with 0.17.0") - constructor(representation: CharSequence) : this({ representation.toString() }) - - @Deprecated("Use the overload which expects String; will be removed with 0.17.0") - constructor(representation: () -> String) : this(representation()) - override val name: String = representation override fun getDefault() = name From a95569cca465565b412172568a57c999213e2f32 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Mon, 5 Apr 2021 21:11:21 +0200 Subject: [PATCH 5/5] remove deprecated AssertionContainer<*>.collectForDifferentSubject --- .../ch/tutteli/atrium/logic/utilsCollect.kt | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utilsCollect.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utilsCollect.kt index 549bf5094a..ff356b3bde 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utilsCollect.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utilsCollect.kt @@ -54,32 +54,6 @@ inline fun AssertionContainer.collectForComposition( noinline assertionCreator: Expect.() -> Unit ): List = collectForCompositionBasedOnSubject(maybeSubject, assertionCreator) -/** - * Use this function if you want to make [Assertion]s about a feature or you perform a type transformation or any - * other action which results in an [Expect] being created for a different subject and - * you do not require this resulting [Expect]. - * - * Or in other words, you do not want to make further assertions about the resulting subject in the resulting sub - * [Expect]. - * - * Note that an assertion will be added which fails in case [assertionCreator] does not create a single assertion. - * - * @param maybeSubject Either [Some] wrapping the subject of the current assertion or - * [None] in case a previous subject transformation was not successful - - * this will be used as subject for the given [assertionCreator]. - * @param assertionCreator A lambda which defines the expectations for the given [maybeSubject]. - * - * @return The collected assertions. - */ -@Deprecated( - "Use collectBasedOnDifferentSubject; will be removed with 0.17.0", - ReplaceWith("this.collectBasedOnDifferentSubject(maybeSubject, assertionCreator)") -) -inline fun AssertionContainer<*>.collectForDifferentSubject( - maybeSubject: Option, - noinline assertionCreator: Expect.() -> Unit -): Assertion = collectBasedOnSubject(maybeSubject, assertionCreator) - /** * Use this function if you want to make [Assertion]s about a feature or you perform a type transformation or any * other action which results in an [Expect] being created for a different subject and @@ -135,7 +109,7 @@ inline fun AssertionContainer<*>.collectForCompositionBasedOnSubject( * which is returned when calling [TransformationExecutionStep.collectAndAppend] with [_logicAppend] * and the given [assertionCreator]. * - * See [collectForDifferentSubject] for more information. + * See [collectBasedOnSubject] for more information. * * @return an [Expect] for the subject of this expectation. */