This commit is contained in:
Robert Stoll
2021-03-02 22:07:59 +01:00
parent 5e2a029962
commit 4c8a5b3e17
2 changed files with 5 additions and 14 deletions

View File

@@ -112,18 +112,12 @@ private infix fun <T : Any> KClass<T>.createChainVia(factories: Sequence<(Compon
this to factories.map { ComponentFactory(it, producesSingleton = false) }
// TODO 0.17.0 I guess it would make sense to cache instance here and only re-create them if this component was merged
// with another because most Atrium users won't change the components and it would most likely just be a waste of
// resources to re-create all over and over again. On the other hand they would be very short-lived an most likely
// just be swept away when GC kicks in (not survive the young generation)
@ExperimentalComponentFactoryContainer
//TODO 0.17.0 or 0.18.0 make internal
object DefaultComponentFactoryContainer : ComponentFactoryContainer by ComponentFactoryContainerImpl(
mapOf(
Reporter::class createSingletonVia { c ->
OnlyFailureReporter(c.build(), c.build())
},
Reporter::class createSingletonVia { c -> OnlyFailureReporter(c.build(), c.build()) },
AssertionFormatterController::class createVia { _ -> DefaultAssertionFormatterController() },
ObjectFormatter::class createVia { c -> c.build<TextObjectFormatter>() },
@@ -161,8 +155,8 @@ object DefaultComponentFactoryContainer : ComponentFactoryContainer by Component
BulletPointProvider::class createVia { _ -> UsingDefaultBulletPoints }
),
mapOf(TextAssertionFormatterFactory::class createChainVia (
sequenceOf(
mapOf(
TextAssertionFormatterFactory::class createChainVia sequenceOf(
{ c ->
val bulletPoints = c.build<BulletPointProvider>().getBulletPoints()
val textAssertionPairFormatter = c.build<TextAssertionPairFormatter>()
@@ -204,5 +198,5 @@ object DefaultComponentFactoryContainer : ComponentFactoryContainer by Component
}
}
)
))
)
)

View File

@@ -1,6 +1,3 @@
//TODO remove file with 0.17.0
@file:Suppress("OverridingDeprecatedMember")
package ch.tutteli.atrium.reporting.impl
import ch.tutteli.atrium.assertions.Assertion
@@ -20,7 +17,7 @@ import ch.tutteli.atrium.reporting.Reporter
*/
class OnlyFailureReporter(
private val assertionFormatterFacade: AssertionFormatterFacade,
override val atriumErrorAdjuster: AtriumErrorAdjuster
@Suppress("OverridingDeprecatedMember") override val atriumErrorAdjuster: AtriumErrorAdjuster
) : Reporter {
/**