Skip to content

Commit

Permalink
remove deprecated Reporter.atriumErrorAdjuster
Browse files Browse the repository at this point in the history
  • Loading branch information
robstoll committed Apr 4, 2021
1 parent f9cca66 commit 8210983
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private infix fun <T : Any> KClass<T>.createChainVia(factories: Sequence<(Compon
object DefaultComponentFactoryContainer : ComponentFactoryContainer by ComponentFactoryContainerImpl(
mapOf(
Reporter::class createSingletonVia { c ->
OnlyFailureReporter(c.build(), c.build())
OnlyFailureReporter(c.build())
},

AssertionFormatterController::class createVia { _ -> DefaultAssertionFormatterController() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import ch.tutteli.atrium.core.CoreFactory
*/
interface Reporter {

/**
* The [AtriumErrorAdjuster] which shall be used to modify stack traces in reporting.
*/
@Deprecated("Do no longer use this but build the AtriumErrorAdjuster based on the configured ComponentFactoryContainer of the Expect/ProofContainer, so that you use the latest configured AtriumErrorAdjuster; will be removed with 0.17.0")
val atriumErrorAdjuster: AtriumErrorAdjuster

/**
* Reports about the given [assertion], using the given [sb] where the actual
* implementation will decide whether the given [assertion] is noteworthy to be reported.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
//TODO remove file with 0.17.0
@file:Suppress("OverridingDeprecatedMember")

package ch.tutteli.atrium.reporting.impl

import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.reporting.AssertionFormatterFacade
import ch.tutteli.atrium.reporting.AtriumError
import ch.tutteli.atrium.reporting.AtriumErrorAdjuster
import ch.tutteli.atrium.reporting.Reporter

/**
Expand All @@ -16,11 +11,9 @@ import ch.tutteli.atrium.reporting.Reporter
*
* @constructor A [Reporter] which reports only failing assertions.
* @param assertionFormatterFacade The formatter used to format [Assertion]s.
* @param atriumErrorAdjuster The adjuster which should be used to adjust the resulting [AtriumError].
*/
class OnlyFailureReporter(
private val assertionFormatterFacade: AssertionFormatterFacade,
override val atriumErrorAdjuster: AtriumErrorAdjuster
private val assertionFormatterFacade: AssertionFormatterFacade
) : Reporter {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fun explainForResolvedLink(
val resolvedPathAssertion = resolvedPathAssertionProvider(realPath)
return if (hintList.isNotEmpty()) {
when (resolvedPathAssertion) {
//TODO 0.17.0 this should be done differently - see isEmptyDirectory !! directory contains is suddenly >> directory contains.
//TODO 0.18.0 this should be done differently - see isEmptyDirectory `!! directory contains` is suddenly `>> directory contains.`
is AssertionGroup -> hintList.addAll(resolvedPathAssertion.assertions)
else -> hintList.add(resolvedPathAssertion)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ import ch.tutteli.atrium.assertions.DescriptiveAssertion
import ch.tutteli.atrium.assertions.RootAssertionGroupType
import ch.tutteli.atrium.assertions.builders.assertionBuilder
import ch.tutteli.atrium.assertions.builders.root
import ch.tutteli.atrium.core.coreFactory
import ch.tutteli.atrium.reporting.AssertionFormatterFacade
import ch.tutteli.atrium.reporting.AtriumErrorAdjuster
import ch.tutteli.atrium.reporting.Reporter
import ch.tutteli.atrium.reporting.erroradjusters.NoOpAtriumErrorAdjuster
import ch.tutteli.atrium.reporting.impl.AssertionFormatterControllerBasedFacade
import ch.tutteli.atrium.reporting.impl.DefaultAssertionFormatterController
import ch.tutteli.atrium.reporting.text.TextAssertionPairFormatter
import ch.tutteli.atrium.reporting.text.impl.DefaultTextObjectFormatter
import ch.tutteli.atrium.reporting.text.impl.TextFallbackAssertionFormatter
import ch.tutteli.atrium.reporting.text.impl.TextObjectFormatterCommon
import ch.tutteli.atrium.reporting.translating.UsingDefaultTranslator
import ch.tutteli.atrium.specs.AssertionVerb
import ch.tutteli.atrium.specs.describeFunTemplate
Expand All @@ -28,7 +24,7 @@ import org.spekframework.spek2.Spek
import org.spekframework.spek2.style.specification.Suite

abstract class OnlyFailureReporterSpec(
testeeFactory: (AssertionFormatterFacade, AtriumErrorAdjuster) -> Reporter,
testeeFactory: (AssertionFormatterFacade) -> Reporter,
describePrefix: String = "[Atrium] "
) : Spek({

Expand All @@ -47,7 +43,7 @@ abstract class OnlyFailureReporterSpec(
objectFormatter
)
}
val testee = testeeFactory(facade, NoOpAtriumErrorAdjuster)
val testee = testeeFactory(facade)

describeFun(testee::format.name) {
val sb = StringBuilder()
Expand Down Expand Up @@ -93,7 +89,7 @@ abstract class OnlyFailureReporterSpec(
val assertionFormatterFacade = mockk<AssertionFormatterFacade>()
every { assertionFormatterFacade.format(any(), any(), any()) } just Runs

val testeeWithMockedFacade = testeeFactory(assertionFormatterFacade, NoOpAtriumErrorAdjuster)
val testeeWithMockedFacade = testeeFactory(assertionFormatterFacade)

it("delegates to ${assertionFormatterFacade::class.simpleName}") {
testeeWithMockedFacade.format(basicAssertion, sb)
Expand Down

0 comments on commit 8210983

Please sign in to comment.