mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
deprecate ReporterFactory and property reporter
This commit is contained in:
@@ -179,7 +179,7 @@ This is due to the loosely coupled design of Atrium and dead code elimination pe
|
||||
Atrium itself is using mocha as well
|
||||
(see [build.gradle -> createJsTestTask](https://github.com/robstoll/atrium/tree/master/build.gradle#L290))
|
||||
and has tests written in JS modules
|
||||
(see [AdjustStackTest](https://github.com/robstoll/atrium/tree/master/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackTest.kt))
|
||||
(see [AdjustStackTest](https://github.com/robstoll/atrium/tree/master/core/api/atrium-core-api-js/src/test/kotlin/ch/tutteli/atrium/reporting/erroradjusters/AdjustStackTest.kt))
|
||||
as well as tests written in common modules (e.g. [SmokeTest](https://github.com/robstoll/atrium/tree/master/bundles/fluent-en_GB/atrium-fluent-en_GB-common/src/test/kotlin/SmokeTest.kt))
|
||||
which are executed on the JS platform as well
|
||||
(actually on all platforms -> JVM uses JUnit for this purpose, see
|
||||
|
||||
@@ -5,11 +5,11 @@ package ch.tutteli.atrium.core.polyfills
|
||||
*
|
||||
* @return The value of the property with the specified [key] or `null` in case it is not defined.
|
||||
*/
|
||||
@Deprecated("Will be removed with 0.17.0 without replacement")
|
||||
@Deprecated("Will be removed with 0.17.0 without replacement - note, a Reporter should now be be retrieved via ComponentFactoryContainer")
|
||||
expect fun getAtriumProperty(key: String): String?
|
||||
|
||||
/**
|
||||
* Sets the property with the given [key] to the given [newValue].
|
||||
*/
|
||||
@Deprecated("Will be removed with 0.17.0 without replacement")
|
||||
@Deprecated("Will be removed with 0.17.0 without replacement - note, a Reporter should now be be retrieved via ComponentFactoryContainer")
|
||||
expect fun setAtriumProperty(key: String, newValue: String)
|
||||
|
||||
@@ -119,9 +119,8 @@ private infix fun <T : Any> KClass<T>.createChainVia(factories: Sequence<(Compon
|
||||
@ExperimentalComponentFactoryContainer
|
||||
//TODO 0.17.0 or 0.18.0 make internal
|
||||
object DefaultComponentFactoryContainer : ComponentFactoryContainer by ComponentFactoryContainerImpl(
|
||||
|
||||
mapOf(
|
||||
Reporter::class createSingletonVia { c ->
|
||||
Reporter::class createSingletonVia { c ->
|
||||
OnlyFailureReporter(c.build(), c.build())
|
||||
},
|
||||
|
||||
@@ -161,7 +160,7 @@ object DefaultComponentFactoryContainer : ComponentFactoryContainer by Component
|
||||
BulletPointProvider::class createVia { _ -> UsingDefaultBulletPoints }
|
||||
),
|
||||
|
||||
mapOf(TextAssertionFormatterFactory::class createChainVia (
|
||||
mapOf(TextAssertionFormatterFactory::class createChainVia
|
||||
sequenceOf(
|
||||
{ c ->
|
||||
val bulletPoints = c.build<BulletPointProvider>().getBulletPoints()
|
||||
@@ -204,5 +203,5 @@ object DefaultComponentFactoryContainer : ComponentFactoryContainer by Component
|
||||
}
|
||||
}
|
||||
)
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -21,6 +21,7 @@ import ch.tutteli.atrium.core.polyfills.setAtriumProperty
|
||||
* Please [open an issue](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=[Feature]%20change%20Reporter%20during%20test%20run)
|
||||
* if you want to able to change the [Reporter] during a test-run.
|
||||
*/
|
||||
@Deprecated("A Reporter should now be be retrieved via ComponentFactoryContainer where the different components of a reporter should also be defined via ComponentFactoryContainer. This property will be removed with 0.17.0")
|
||||
val reporter: Reporter by lazy {
|
||||
val id = getAtriumProperty(ReporterFactory.ATRIUM_PROPERTY_KEY) ?: "default"
|
||||
val factory = loadServices(ReporterFactory::class)
|
||||
@@ -37,7 +38,7 @@ val reporter: Reporter by lazy {
|
||||
* It identify itself via its [id]. This id can be used by a user to specify that this [ReporterFactory] shall be used.
|
||||
* In order to do that, the user has to define the system property `ch.tutteli.atrium.reporting.reporterFactory`
|
||||
*/
|
||||
//TODO 0.16.0 deprecate
|
||||
@Deprecated("A Reporter should now be be retrieved via ComponentFactoryContainer where the different components of a reporter should also be defined via ComponentFactoryContainer. This class will be removed with 0.17.0")
|
||||
interface ReporterFactory {
|
||||
/**
|
||||
* Identification of the supplier
|
||||
@@ -52,11 +53,13 @@ interface ReporterFactory {
|
||||
/**
|
||||
* Provides utility functions to specify a [ReporterFactory].
|
||||
*/
|
||||
@Suppress("DeprecatedCallableAddReplaceWith")
|
||||
companion object {
|
||||
/**
|
||||
* The key of Atrium's property which is used to define which [ReporterFactory] shall be used.
|
||||
* You can use [ReporterFactory.specifyFactory] or [ReporterFactory.specifyFactoryIfNotYetSet]
|
||||
*/
|
||||
@Deprecated("A Reporter should now be be retrieved via ComponentFactoryContainer where the different components of a reporter should also be defined via ComponentFactoryContainer. ReporterFactory will be removed with 0.17.0")
|
||||
const val ATRIUM_PROPERTY_KEY = "ch.tutteli.atrium.reporting.reporterFactory"
|
||||
|
||||
/**
|
||||
@@ -67,6 +70,7 @@ interface ReporterFactory {
|
||||
* Use [specifyFactoryIfNotYetSet] if you only want to set a default value but not overwrite an existing
|
||||
* specification.
|
||||
*/
|
||||
@Deprecated("A Reporter should now be be retrieved via ComponentFactoryContainer where the different components of a reporter should also be defined via ComponentFactoryContainer. ReporterFactory will be removed with 0.17.0")
|
||||
fun specifyFactory(reporterFactoryId: String) {
|
||||
setAtriumProperty(ATRIUM_PROPERTY_KEY, reporterFactoryId)
|
||||
}
|
||||
@@ -79,6 +83,7 @@ interface ReporterFactory {
|
||||
* Use [specifyFactory] if you do not care if another id was specified before or in other words, if you want to
|
||||
* overwrite a potentially previously defined id.
|
||||
*/
|
||||
@Deprecated("A Reporter should now be be retrieved via ComponentFactoryContainer where the different components of a reporter should also be defined via ComponentFactoryContainer. ReporterFactory will be removed with 0.17.0")
|
||||
fun specifyFactoryIfNotYetSet(reporterFactoryId: String) {
|
||||
if (getAtriumProperty(ATRIUM_PROPERTY_KEY) == null) {
|
||||
specifyFactory(reporterFactoryId)
|
||||
|
||||
@@ -11,8 +11,6 @@ import ch.tutteli.atrium.creating.build
|
||||
import ch.tutteli.atrium.logic._logic
|
||||
import ch.tutteli.atrium.logic.creating.RootExpectBuilder
|
||||
import ch.tutteli.atrium.reporting.AtriumErrorAdjuster
|
||||
import ch.tutteli.atrium.reporting.Reporter
|
||||
import ch.tutteli.atrium.reporting.reporter
|
||||
import kotlin.test.Test
|
||||
|
||||
class AdjustStackTest {
|
||||
|
||||
@@ -2,10 +2,8 @@ package ch.tutteli.atrium.reporting.translating
|
||||
|
||||
import ch.tutteli.atrium.creating.ExperimentalComponentFactoryContainer
|
||||
import ch.tutteli.atrium.creating.build
|
||||
import ch.tutteli.atrium.domain.builders.reporting.ReporterBuilder
|
||||
import ch.tutteli.atrium.reporting.translating.impl.TranslationSupplierBasedTranslator
|
||||
import ch.tutteli.atrium.specs.reporting.translating.RealTranslatorIntSpec
|
||||
import ch.tutteli.atrium.specs.reporting.translating.TranslatorIntSpec
|
||||
|
||||
@ExperimentalComponentFactoryContainer
|
||||
object PropertiesPerEntityAndLocaleTranslationSupplierSpec : RealTranslatorIntSpec(
|
||||
|
||||
@@ -18,7 +18,7 @@ import ch.tutteli.atrium.reporting.Reporter
|
||||
* @param assertionFormatterFacade The formatter used to format [Assertion]s.
|
||||
* @param atriumErrorAdjuster The adjuster which should be used to adjust the resulting [AtriumError].
|
||||
*/
|
||||
//TODO deprecate with 0.16.0
|
||||
@Deprecated("Reporting will fundamentally change with the replacement of Assertion with Proof in 0.17.0. There is a replacement in 0.16.0 in atrium-api-core which will be deprecated again in 0.17.0. This class will be removed with 0.17.0")
|
||||
class OnlyFailureReporter(
|
||||
private val assertionFormatterFacade: AssertionFormatterFacade,
|
||||
override val atriumErrorAdjuster: AtriumErrorAdjuster
|
||||
|
||||
@@ -11,7 +11,6 @@ import ch.tutteli.atrium.core.coreFactory
|
||||
import ch.tutteli.atrium.core.polyfills.stackBacktrace
|
||||
import ch.tutteli.atrium.creating.ExperimentalComponentFactoryContainer
|
||||
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 ch.tutteli.atrium.reporting.reporter
|
||||
|
||||
@@ -11,6 +11,7 @@ import ch.tutteli.atrium.reporting.translating.TranslationSupplier
|
||||
import ch.tutteli.atrium.reporting.translating.Translator
|
||||
import ch.tutteli.atrium.reporting.translating.UsingDefaultTranslator
|
||||
|
||||
@Deprecated("Configure components via withOptions when creating an expectation verb instead; will be removed with 0.17.0")
|
||||
internal actual object ReporterBuilderImpl : ReporterBuilder {
|
||||
|
||||
override fun withoutTranslations(primaryLocale: Locale) = withTranslator(UsingDefaultTranslator(primaryLocale))
|
||||
|
||||
@@ -14,6 +14,7 @@ import ch.tutteli.atrium.reporting.translating.*
|
||||
/**
|
||||
* Provides options to create a [Translator] or [TranslationSupplier].
|
||||
*/
|
||||
@Deprecated("Configure components via withOptions when creating an expectation verb instead; will be removed with 0.17.0")
|
||||
actual interface ReporterBuilder : ReporterBuilderCommon {
|
||||
actual companion object {
|
||||
actual fun create(): ReporterBuilder = ReporterBuilderImpl
|
||||
|
||||
@@ -17,6 +17,7 @@ import ch.tutteli.atrium.reporting.AssertionPairFormatter
|
||||
/**
|
||||
* Provides options to register [AssertionFormatter]s to the chosen [AssertionFormatterFacade].
|
||||
*/
|
||||
@Deprecated("Configure components via withOptions when creating an expectation verb instead; will be removed with 0.17.0")
|
||||
actual interface TextAssertionFormatterOption : TextAssertionFormatterOptionCommon {
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ import ch.tutteli.atrium.reporting.translating.Translator
|
||||
/**
|
||||
* Provides options to create a [Translator].
|
||||
*/
|
||||
@Deprecated("Configure components via withOptions when creating an expectation verb instead; will be removed with 0.17.0")
|
||||
actual interface TranslatorOption : TranslatorOptionCommon {
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ import ch.tutteli.atrium.reporting.translating.TranslationSupplier
|
||||
import ch.tutteli.atrium.reporting.translating.Translator
|
||||
import ch.tutteli.atrium.reporting.translating.UsingDefaultTranslator
|
||||
|
||||
@Deprecated("Configure components via withOptions when creating an expectation verb instead; will be removed with 0.17.0")
|
||||
internal actual object ReporterBuilderImpl : ReporterBuilder {
|
||||
|
||||
override fun withoutTranslations(primaryLocale: Locale) = withTranslator(UsingDefaultTranslator(primaryLocale))
|
||||
|
||||
@@ -9,6 +9,7 @@ module ch.tutteli.atrium.domain.builders {
|
||||
exports ch.tutteli.atrium.domain.builders.reporting;
|
||||
exports ch.tutteli.atrium.domain.builders.utils;
|
||||
|
||||
//TODO 0.17.0 remove
|
||||
provides ch.tutteli.atrium.reporting.ReporterFactory
|
||||
with ch.tutteli.atrium.domain.builders.reporting.impl.DefaultReporterFactory;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ module ch.tutteli.atrium.verbs.internal {
|
||||
requires ch.tutteli.atrium.domain.builders;
|
||||
requires kotlin.stdlib;
|
||||
|
||||
//TODO 0.17.0 remove
|
||||
uses ch.tutteli.atrium.reporting.ReporterFactory;
|
||||
|
||||
exports ch.tutteli.atrium.api.verbs.internal;
|
||||
|
||||
@@ -2,6 +2,7 @@ module ch.tutteli.atrium.verbs {
|
||||
requires ch.tutteli.atrium.domain.builders;
|
||||
requires kotlin.stdlib;
|
||||
|
||||
//TODO 0.17.0 remove
|
||||
uses ch.tutteli.atrium.reporting.ReporterFactory;
|
||||
|
||||
exports ch.tutteli.atrium.api.verbs;
|
||||
|
||||
Reference in New Issue
Block a user