Merge pull request #859 from robstoll/remove-deprecated-stuff

remove deprecated stuff part 2
This commit is contained in:
Robert Stoll
2021-04-05 22:14:11 +02:00
committed by GitHub
30 changed files with 89 additions and 228 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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<MethodCallFormatter>(); will be removed with 0.17.0")
@Deprecated("Create a new MethodCallFormatter via the ComponentFactoryContainer, e.g. via _logic.components.build<MethodCallFormatter>(); 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<Translator>(); will be removed with 0.17.0")
@Deprecated("Create a new Translator via the ComponentFactoryContainer, e.g. via _logic.components.build<Translator>(); 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<LocaleOrderDecider>(); will be removed with 0.17.0")
@Deprecated("Create a new LocaleOrderDecider via the ComponentFactoryContainer, e.g. via _logic.components.build<LocaleOrderDecider>(); 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<ObjectFormatter>(); will be removed with 0.17.0")
@Deprecated("Create a new ObjectFormatter via the ComponentFactoryContainer, e.g. via _logic.components.build<ObjectFormatter>(); 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<KClass<out BulletPointIdentifier>, 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<KClass<out BulletPointIdentifier>, 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<KClass<out BulletPointIdentifier>, 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<KClass<out BulletPointIdentifier>, 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<KClass<out BulletPointIdentifier>, 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<KClass<out BulletPointIdentifier>, 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<RemoveRunnerFromAtriumError>(); will be removed with 0.17.0")
@Deprecated("Create a new RemoveRunnerFromAtriumError via the ComponentFactoryContainer, e.g. via _logic.components.build<RemoveRunnerFromAtriumError>(); 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<RemoveAtriumFromAtriumError>(); will be removed with 0.17.0")
@Deprecated("Create a new RemoveAtriumFromAtriumError via the ComponentFactoryContainer, e.g. via _logic.components.build<RemoveAtriumFromAtriumError>(); 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"

View File

@@ -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 <T : Any> loadSingleService(kClass: KClass<T>): T
/**
@@ -19,7 +20,7 @@ expect fun <T : Any> loadSingleService(kClass: KClass<T>): 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 <T : Any> loadServices(kClass: KClass<T>): Sequence<T>
/**
@@ -28,7 +29,7 @@ expect fun <T : Any> loadServices(kClass: KClass<T>): Sequence<T>
* @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 <T : Any> useSingleService(kClass: KClass<T>, itr: Iterator<T>): T {
if (!itr.hasNext()) throw NoSuchElementException("Could not find any implementation for ${kClass.fullName}")

View File

@@ -32,7 +32,7 @@ interface AssertionContainer<T> : @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 <I : Any> getImpl(kClass: KClass<I>, defaultFactory: () -> I): I

View File

@@ -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")

View File

@@ -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
* &rarr; 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.

View File

@@ -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 &rarr; 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

View File

@@ -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<out Any?>): () -> 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<out Any?>): String
/**
* Formats the given [argument].
*/

View File

@@ -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)
}
}

View File

@@ -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.
*/

View File

@@ -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)"
}
}

View File

@@ -15,10 +15,6 @@ object DefaultTextMethodCallFormatter : TextMethodCallFormatter {
override fun formatCall(methodName: String, arguments: Array<out Any?>): String =
arguments.joinToString(", ", prefix = "$methodName(", postfix = ")") { formatArgument(it) }
override fun format(methodName: String, arguments: Array<out Any?>): () -> 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")

View File

@@ -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)
}

View File

@@ -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))

View File

@@ -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)"
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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<KClass<*>, HashSet<Any>>()
@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0")
actual fun <T : Any> loadSingleService(kClass: KClass<T>): T =
useSingleService(kClass, loadServices(kClass).iterator())
@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0")
actual fun <T : Any> loadServices(kClass: KClass<T>): Sequence<T> {
@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 <T : Any> loadServices(kClass: KClass<T>): Sequence<T> {
/**
* Registers the given [service] for the service of type [T].
*/
@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0")
inline fun <reified T : Any> 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 <T : Any> registerService(serviceInterface: KClass<T>, service: () -> T) {
val services = serviceRegistry.getOrPut(serviceInterface) { hashSetOf() }
services.add(service)

View File

@@ -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(

View File

@@ -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 <T : Any> loadSingleService(kClass: KClass<T>): T =
useSingleService(kClass, ServiceLoader.load(kClass.java).iterator())
@Deprecated("Retrieve components via ComponentFactoryContainer; will be removed with 0.18.0")
actual fun <T : Any> loadServices(kClass: KClass<T>): Sequence<T> =
ServiceLoader.load(kClass.java).asSequence()

View File

@@ -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

View File

@@ -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

View File

@@ -54,32 +54,6 @@ inline fun <T> AssertionContainer<T>.collectForComposition(
noinline assertionCreator: Expect<T>.() -> Unit
): List<Assertion> = 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 <T> AssertionContainer<*>.collectForDifferentSubject(
maybeSubject: Option<T>,
noinline assertionCreator: Expect<T>.() -> 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 <T> 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.
*/

View File

@@ -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

View File

@@ -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

View File

@@ -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)
}
}
}
})

View File

@@ -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

View File

@@ -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<String, () -> 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 ->