mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
kotlin.code.style.official, reformat newer code
no need to reformat deprecated functionality
This commit is contained in:
@@ -24,8 +24,12 @@ class CharSequenceContainsExactlyAssertionsSpec :
|
||||
("$contains.$ignoringCase.$exactly" to Companion::containsExactlyIgnoringCase)
|
||||
|
||||
|
||||
private fun containsExactlyIgnoringCase(expect: Expect<CharSequence>, exactly: Int, a: Any, aX: Array<out Any>) =
|
||||
expect.contains.ignoringCase.exactly(exactly).values(a, *aX)
|
||||
private fun containsExactlyIgnoringCase(
|
||||
expect: Expect<CharSequence>,
|
||||
exactly: Int,
|
||||
a: Any,
|
||||
aX: Array<out Any>
|
||||
) = expect.contains.ignoringCase.exactly(exactly).values(a, *aX)
|
||||
|
||||
|
||||
private fun getContainsNotPair() = containsNot to Companion::getErrorMsgContainsNot
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
|
||||
|
||||
class FeatureAssertionsBoundedReferenceAlternativeSpec : ch.tutteli.atrium.specs.integration.FeatureAssertionsSpec(
|
||||
propertyImmediate,
|
||||
propertyLazy,
|
||||
@@ -102,4 +100,3 @@ class FeatureAssertionsBoundedReferenceAlternativeSpec : ch.tutteli.atrium.specs
|
||||
val f5EmptyAssertionCreator: F = { feature({ f5(it::return5, "a", 1, true, 1.2, 'b') }) {} }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@ import java.math.BigDecimal
|
||||
* @return This assertion container to support a fluent API.
|
||||
* @throws AssertionError Might throw an [AssertionError] if the assertion made is not correct.
|
||||
*/
|
||||
fun <T: BigDecimal> Expect<T>.toBeWithErrorTolerance(expected: BigDecimal, tolerance: BigDecimal)
|
||||
= addAssertion(ExpectImpl.floatingPoint.toBeWithErrorTolerance(this, expected, tolerance))
|
||||
fun <T : BigDecimal> Expect<T>.toBeWithErrorTolerance(expected: BigDecimal, tolerance: BigDecimal) =
|
||||
addAssertion(ExpectImpl.floatingPoint.toBeWithErrorTolerance(this, expected, tolerance))
|
||||
|
||||
@@ -298,6 +298,7 @@ def createRegisterJsServicesTask(String projectName, String packageName, Functio
|
||||
doLast {
|
||||
services.write("""\
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package $packageName
|
||||
|
||||
import ch.tutteli.atrium.core.polyfills.registerService
|
||||
|
||||
@@ -4,7 +4,7 @@ import ch.tutteli.atrium.api.fluent.en_GB.toBe
|
||||
import ch.tutteli.atrium.api.verbs.assertThat
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.AssertImpl
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable
|
||||
import ch.tutteli.atrium.translations.DescriptionBasic
|
||||
@@ -31,7 +31,9 @@ fun Expect<Int>.isEven() =
|
||||
fun Expect<Int>.isMultipleOf(base: Int) = addAssertion(_isMultipleOf(this, base))
|
||||
|
||||
fun _isMultipleOf(assertionContainer: Expect<Int>, base: Int): Assertion =
|
||||
AssertImpl.builder.createDescriptive(assertionContainer, DescriptionIntAssertions.IS_MULTIPLE_OF, base) { it % base == 0 }
|
||||
ExpectImpl.builder.createDescriptive(assertionContainer, DescriptionIntAssertions.IS_MULTIPLE_OF, base) {
|
||||
it % base == 0
|
||||
}
|
||||
|
||||
enum class DescriptionIntAssertions(override val value: String) : StringBasedTranslatable {
|
||||
IS_MULTIPLE_OF("is multiple of")
|
||||
|
||||
@@ -16,7 +16,8 @@ interface AssertionGroup : Assertion {
|
||||
val description: Translatable
|
||||
|
||||
@Deprecated("Use description; will be removed with 1.0.0", ReplaceWith("description"))
|
||||
val name get() = description
|
||||
val name
|
||||
get() = description
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,7 +35,8 @@ interface AssertionGroup : Assertion {
|
||||
val representation: Any
|
||||
|
||||
@Deprecated("Use representation; will be removed with 1.0.0", ReplaceWith("representation"))
|
||||
val subject get() = representation
|
||||
val subject
|
||||
get() = representation
|
||||
|
||||
|
||||
/**
|
||||
@@ -113,14 +115,14 @@ interface AssertionGroup : Assertion {
|
||||
|
||||
@Deprecated("Use AssertImpl.builder instead; will be removed with 1.0.0")
|
||||
class BasicAssertionGroupBuilder(private val groupType: AssertionGroupType) {
|
||||
fun create(name: Translatable, subject: Any, assertion: Assertion): AssertionGroup
|
||||
= assertionBuilder.customType(groupType)
|
||||
fun create(name: Translatable, subject: Any, assertion: Assertion): AssertionGroup =
|
||||
assertionBuilder.customType(groupType)
|
||||
.withDescriptionAndRepresentation(name, subject)
|
||||
.withAssertion(assertion)
|
||||
.build()
|
||||
|
||||
fun create(name: Translatable, subject: Any, assertions: List<Assertion>): AssertionGroup
|
||||
= assertionBuilder.customType(groupType)
|
||||
fun create(name: Translatable, subject: Any, assertions: List<Assertion>): AssertionGroup =
|
||||
assertionBuilder.customType(groupType)
|
||||
.withDescriptionAndRepresentation(name, subject)
|
||||
.withAssertions(assertions)
|
||||
.build()
|
||||
@@ -137,22 +139,21 @@ interface AssertionGroup : Assertion {
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Use AssertImpl.builder instead; will be removed with 1.0.0")
|
||||
class ExplanatoryAssertionGroupBuilder(private val groupType: ExplanatoryAssertionGroupType) {
|
||||
fun create(assertion: Assertion): ExplanatoryAssertionGroup
|
||||
= create(assertion)
|
||||
fun create(assertion: Assertion): ExplanatoryAssertionGroup = create(assertion)
|
||||
|
||||
fun create(assertions: List<Assertion>): ExplanatoryAssertionGroup
|
||||
= ExplanatoryAssertionGroup(groupType, assertions)
|
||||
fun create(assertions: List<Assertion>): ExplanatoryAssertionGroup =
|
||||
ExplanatoryAssertionGroup(groupType, assertions)
|
||||
}
|
||||
|
||||
@Deprecated("Use AssertImpl.builder instead; will be removed with 1.0.0")
|
||||
class EmptyNameAndSubjectAssertionGroupBuilder(private val groupType: AssertionGroupType) {
|
||||
fun create(assertion: Assertion): AssertionGroup
|
||||
= AssertionsOption.withDefaultFinalStepAndEmptyDescriptionAndRepresentation(groupType)
|
||||
fun create(assertion: Assertion): AssertionGroup =
|
||||
AssertionsOption.withDefaultFinalStepAndEmptyDescriptionAndRepresentation(groupType)
|
||||
.withAssertion(assertion)
|
||||
.build()
|
||||
|
||||
fun create(assertions: List<Assertion>): AssertionGroup
|
||||
= AssertionsOption.withDefaultFinalStepAndEmptyDescriptionAndRepresentation(groupType)
|
||||
fun create(assertions: List<Assertion>): AssertionGroup =
|
||||
AssertionsOption.withDefaultFinalStepAndEmptyDescriptionAndRepresentation(groupType)
|
||||
.withAssertions(assertions)
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ interface DescriptiveAssertion : Assertion {
|
||||
val representation: Any
|
||||
|
||||
@Deprecated("Use representation; will be removed with 1.0.0", ReplaceWith("representation"))
|
||||
val expected get() = representation
|
||||
val expected
|
||||
get() = representation
|
||||
|
||||
/**
|
||||
* The complementary description to the [representation] result such as `contains`, `is not` etc.
|
||||
|
||||
@@ -10,5 +10,5 @@ package ch.tutteli.atrium.assertions
|
||||
*/
|
||||
@Suppress("DEPRECATION" /* TODO remove with 1.0.0 */)
|
||||
@Deprecated("So far indentation was achieved by grouping (which is the solution to go). See AssertImpl.builder for different groups. Will be removed with 1.0.0")
|
||||
class IndentAssertionGroup(assertions: List<Assertion>)
|
||||
: EmptyNameAndRepresentationAssertionGroup(DefaultIndentAssertionGroupType, assertions)
|
||||
class IndentAssertionGroup(assertions: List<Assertion>) :
|
||||
EmptyNameAndRepresentationAssertionGroup(DefaultIndentAssertionGroupType, assertions)
|
||||
|
||||
@@ -9,5 +9,5 @@ package ch.tutteli.atrium.assertions
|
||||
*/
|
||||
@Suppress("DEPRECATION" /* TODO remove with 1.0.0 */)
|
||||
@Deprecated("Use AssertionGroup, do not rely on this specific type, will be made internal with 1.0.0")
|
||||
class InvisibleAssertionGroup internal constructor(assertions: List<Assertion>)
|
||||
: EmptyNameAndRepresentationAssertionGroup(InvisibleAssertionGroupType, assertions)
|
||||
class InvisibleAssertionGroup internal constructor(assertions: List<Assertion>) :
|
||||
EmptyNameAndRepresentationAssertionGroup(InvisibleAssertionGroupType, assertions)
|
||||
|
||||
@@ -3,9 +3,9 @@ package ch.tutteli.atrium.assertions.builders
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
import ch.tutteli.atrium.assertions.AssertionGroupType
|
||||
import ch.tutteli.atrium.assertions.builders.impl.AssertionGroupDescriptionAndEmptyRepresentationOptionImpl
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
import ch.tutteli.atrium.reporting.translating.Untranslatable
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
|
||||
/**
|
||||
* Option step which allows to specify the [AssertionGroup.description] -- [RawString.EMPTY] is
|
||||
@@ -38,6 +38,7 @@ interface AssertionGroupDescriptionAndEmptyRepresentationOption<out T: Assertion
|
||||
fun <T : AssertionGroupType, R> create(
|
||||
type: T,
|
||||
factory: (T, Translatable, Any) -> R
|
||||
): AssertionGroupDescriptionAndEmptyRepresentationOption<T, R> = AssertionGroupDescriptionAndEmptyRepresentationOptionImpl(type, factory)
|
||||
): AssertionGroupDescriptionAndEmptyRepresentationOption<T, R> =
|
||||
AssertionGroupDescriptionAndEmptyRepresentationOptionImpl(type, factory)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ interface AssertionsOption<out T : AssertionGroupType, out R> {
|
||||
/**
|
||||
* Uses the given [assertion1], [assertion2] and [assertion3] as [AssertionGroup.assertions].
|
||||
*/
|
||||
fun withAssertions(assertion1: Assertion, assertion2: Assertion, assertion3: Assertion): R
|
||||
= withAssertions(listOf(assertion1, assertion2, assertion3))
|
||||
fun withAssertions(assertion1: Assertion, assertion2: Assertion, assertion3: Assertion): R =
|
||||
withAssertions(listOf(assertion1, assertion2, assertion3))
|
||||
|
||||
/**
|
||||
* Uses the given [assertions] as [AssertionGroup.assertions].
|
||||
@@ -82,8 +82,12 @@ interface AssertionsOption<out T : AssertionGroupType, out R> {
|
||||
*/
|
||||
fun <T : AssertionGroupType> withDefaultFinalStepAndEmptyDescriptionAndRepresentation(
|
||||
groupType: T
|
||||
): AssertionsOption<T, BasicAssertionGroupFinalStep>
|
||||
= AssertionsOptionImpl(groupType, Untranslatable.EMPTY, RawString.EMPTY, BasicAssertionGroupFinalStep.Companion::create)
|
||||
): AssertionsOption<T, BasicAssertionGroupFinalStep> = AssertionsOptionImpl(
|
||||
groupType,
|
||||
Untranslatable.EMPTY,
|
||||
RawString.EMPTY,
|
||||
BasicAssertionGroupFinalStep.Companion::create
|
||||
)
|
||||
|
||||
/**
|
||||
* Returns a factory method which creates an [AssertionsOption] where [BasicAssertionGroupFinalStep] is used
|
||||
@@ -95,12 +99,13 @@ interface AssertionsOption<out T : AssertionGroupType, out R> {
|
||||
/* that's fine because T is covariant and we do not need multiple function objects for the same functionality */
|
||||
"UNCHECKED_CAST"
|
||||
)
|
||||
val factory = factoryWithDefaultFinalStep as (T, Translatable, Any) -> AssertionsOption<T, BasicAssertionGroupFinalStep>
|
||||
val factory =
|
||||
factoryWithDefaultFinalStep as (T, Translatable, Any) -> AssertionsOption<T, BasicAssertionGroupFinalStep>
|
||||
return factory
|
||||
}
|
||||
|
||||
private val factoryWithDefaultFinalStep: (AssertionGroupType, Translatable, Any) -> AssertionsOption<AssertionGroupType, BasicAssertionGroupFinalStep>
|
||||
= { t, d, r ->
|
||||
private val factoryWithDefaultFinalStep: (AssertionGroupType, Translatable, Any) -> AssertionsOption<AssertionGroupType, BasicAssertionGroupFinalStep> =
|
||||
{ t, d, r ->
|
||||
AssertionsOptionImpl(t, d, r, BasicAssertionGroupFinalStep.Companion::create)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ interface BasicAssertionGroupFinalStep : AssertionBuilderFinalStep<AssertionGrou
|
||||
description: Translatable,
|
||||
representation: Any,
|
||||
assertions: List<Assertion>
|
||||
): BasicAssertionGroupFinalStep = BasicAssertionGroupFinalStepImpl(groupType, description, representation, assertions)
|
||||
): BasicAssertionGroupFinalStep = BasicAssertionGroupFinalStepImpl(
|
||||
groupType, description, representation, assertions
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ interface Descriptive {
|
||||
* Notice, if you want to use text (e.g. a [String]) as representation,
|
||||
* then wrap it into a [RawString] via [RawString.create] and pass the [RawString] instead.
|
||||
*/
|
||||
fun withDescriptionAndRepresentation(description: String, representation: Any?): R
|
||||
= withDescriptionAndRepresentation(Untranslatable(description), representation)
|
||||
fun withDescriptionAndRepresentation(description: String, representation: Any?): R =
|
||||
withDescriptionAndRepresentation(Untranslatable(description), representation)
|
||||
|
||||
/**
|
||||
* Uses the given [description] as [DescriptiveAssertion.description] and [representation]
|
||||
|
||||
@@ -27,14 +27,13 @@ interface Explanatory {
|
||||
* It delegates to the overload which expects a single [Translatable]; see there for more details about
|
||||
* how the [Translatable] is used as [ExplanatoryAssertion.explanation].
|
||||
*/
|
||||
fun withExplanation(translatable: Translatable, arg: Any, vararg otherArgs: Any): FinalStep
|
||||
= withExplanation(TranslatableWithArgs(translatable, arg glue otherArgs))
|
||||
fun withExplanation(translatable: Translatable, arg: Any, vararg otherArgs: Any): FinalStep =
|
||||
withExplanation(TranslatableWithArgs(translatable, arg glue otherArgs))
|
||||
|
||||
/**
|
||||
* Uses the given [description] as explanation.
|
||||
*/
|
||||
fun withExplanation(description: String): FinalStep
|
||||
= withExplanation(Untranslatable(description))
|
||||
fun withExplanation(description: String): FinalStep = withExplanation(Untranslatable(description))
|
||||
|
||||
/**
|
||||
* Uses the given [translatable] as explanation.
|
||||
@@ -42,8 +41,7 @@ interface Explanatory {
|
||||
* In detail, the given [translatable] is turned into a [RawString] so that an [ObjectFormatter] translates the
|
||||
* given [translatable] and treats the result as raw string.
|
||||
*/
|
||||
fun withExplanation(translatable: Translatable): FinalStep
|
||||
= withExplanation(RawString.create(translatable))
|
||||
fun withExplanation(translatable: Translatable): FinalStep = withExplanation(RawString.create(translatable))
|
||||
|
||||
/**
|
||||
* Uses the given [explanation] as [ExplanatoryAssertion.explanation].
|
||||
@@ -54,15 +52,24 @@ interface Explanatory {
|
||||
fun withExplanation(explanation: Any?): FinalStep
|
||||
|
||||
|
||||
@Deprecated("use withExplanation instead; will be removed with 1.0.0", ReplaceWith("this.withExplanation(translatable, arg, *otherArgs)"))
|
||||
fun withDescription(translatable: Translatable, arg: Any, vararg otherArgs: Any): FinalStep
|
||||
= withExplanation(translatable, arg, *otherArgs)
|
||||
@Deprecated(
|
||||
"use withExplanation instead; will be removed with 1.0.0",
|
||||
ReplaceWith("this.withExplanation(translatable, arg, *otherArgs)")
|
||||
)
|
||||
fun withDescription(translatable: Translatable, arg: Any, vararg otherArgs: Any): FinalStep =
|
||||
withExplanation(translatable, arg, *otherArgs)
|
||||
|
||||
|
||||
@Deprecated("use withExplanation instead; will be removed with 1.0.0", ReplaceWith("this.withExplanation(translatable)"))
|
||||
@Deprecated(
|
||||
"use withExplanation instead; will be removed with 1.0.0",
|
||||
ReplaceWith("this.withExplanation(translatable)")
|
||||
)
|
||||
fun withDescription(translatable: Translatable): FinalStep = withExplanation(translatable)
|
||||
|
||||
@Deprecated("use withExplanation instead; will be removed with 1.0.0", ReplaceWith("this.withExplanation(explanation)"))
|
||||
@Deprecated(
|
||||
"use withExplanation instead; will be removed with 1.0.0",
|
||||
ReplaceWith("this.withExplanation(explanation)")
|
||||
)
|
||||
fun withDescription(explanation: Any?): FinalStep = withExplanation(explanation)
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,10 @@ fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertion
|
||||
* See [AssertionsOption.withAssertion] for details.
|
||||
*/
|
||||
@Suppress("DEPRECATION" /* TODO exchange ExplanatoryAssertionGroupFinalStep with ExplanatoryGroup.FinalStep in 1.0.0 */)
|
||||
@Deprecated("use withExplanatoryAssertion instead; will be removed with 1.0.0", ReplaceWith("this.withExplanatoryAssertion(translatable, arg, *otherArgs)"))
|
||||
@Deprecated(
|
||||
"use withExplanatoryAssertion instead; will be removed with 1.0.0",
|
||||
ReplaceWith("this.withExplanatoryAssertion(translatable, arg, *otherArgs)")
|
||||
)
|
||||
fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertionGroupFinalStep>.withExplanatoryAssertions(
|
||||
translatable: Translatable,
|
||||
arg: Any,
|
||||
@@ -120,7 +123,8 @@ fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertion
|
||||
translatable: Translatable,
|
||||
arg: Any,
|
||||
vararg otherArgs: Any
|
||||
): ExplanatoryAssertionGroupFinalStep = withExplanatoryAssertion { it.withExplanation(translatable, arg, *otherArgs).build() }
|
||||
): ExplanatoryAssertionGroupFinalStep =
|
||||
withExplanatoryAssertion { it.withExplanation(translatable, arg, *otherArgs).build() }
|
||||
|
||||
|
||||
/**
|
||||
@@ -139,7 +143,10 @@ inline fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAs
|
||||
* Option step which allows to specify what [ExplanatoryAssertionGroupType] is used as [AssertionGroup.type].
|
||||
*/
|
||||
@Suppress("DEPRECATION" /* TODO remove whole interface with 1.0.0 */)
|
||||
@Deprecated("Use ExplanatoryGroup.GroupTypeOption instead; will be removed with 1.0.0", ReplaceWith("ExplanatoryGroup.GroupTypeOption"))
|
||||
@Deprecated(
|
||||
"Use ExplanatoryGroup.GroupTypeOption instead; will be removed with 1.0.0",
|
||||
ReplaceWith("ExplanatoryGroup.GroupTypeOption")
|
||||
)
|
||||
interface ExplanatoryAssertionGroupTypeOption {
|
||||
|
||||
/**
|
||||
@@ -162,7 +169,10 @@ interface ExplanatoryAssertionGroupTypeOption {
|
||||
* Final step which creates an [AssertionGroup] with an [ExplanatoryAssertionGroupType] based on the previously
|
||||
* defined [groupType] and the [explanatoryAssertions].
|
||||
*/
|
||||
@Deprecated("Use ExplanatoryGroup.FinalStep instead; will be removed with 1.0.0", ReplaceWith("ExplanatoryGroup.FinalStep"))
|
||||
@Deprecated(
|
||||
"Use ExplanatoryGroup.FinalStep instead; will be removed with 1.0.0",
|
||||
ReplaceWith("ExplanatoryGroup.FinalStep")
|
||||
)
|
||||
interface ExplanatoryAssertionGroupFinalStep : AssertionBuilderFinalStep<AssertionGroup> {
|
||||
/**
|
||||
* The previously defined [AssertionGroup.type].
|
||||
|
||||
@@ -5,28 +5,28 @@ import ch.tutteli.atrium.assertions.builders.*
|
||||
|
||||
internal object AssertionBuilderImpl : AssertionBuilder {
|
||||
|
||||
override val list: DefaultAssertionGroupBuilderOptions<ListAssertionGroupType>
|
||||
= createDescriptionAndRepresentationOption(DefaultListAssertionGroupType)
|
||||
override val list: DefaultAssertionGroupBuilderOptions<ListAssertionGroupType> =
|
||||
createDescriptionAndRepresentationOption(DefaultListAssertionGroupType)
|
||||
|
||||
override val feature: DefaultAssertionGroupBuilderOptions<FeatureAssertionGroupType>
|
||||
= createDescriptionAndRepresentationOption(DefaultFeatureAssertionGroupType)
|
||||
override val feature: DefaultAssertionGroupBuilderOptions<FeatureAssertionGroupType> =
|
||||
createDescriptionAndRepresentationOption(DefaultFeatureAssertionGroupType)
|
||||
|
||||
override val summary: AssertionGroupDescriptionAndEmptyRepresentationOption<SummaryAssertionGroupType, AssertionsOption<SummaryAssertionGroupType, BasicAssertionGroupFinalStep>>
|
||||
= AssertionGroupDescriptionAndEmptyRepresentationOption.create(DefaultSummaryAssertionGroupType, AssertionsOption.factoryWithDefaultFinalStep())
|
||||
override val summary: AssertionGroupDescriptionAndEmptyRepresentationOption<SummaryAssertionGroupType, AssertionsOption<SummaryAssertionGroupType, BasicAssertionGroupFinalStep>> =
|
||||
AssertionGroupDescriptionAndEmptyRepresentationOption.create(
|
||||
DefaultSummaryAssertionGroupType,
|
||||
AssertionsOption.factoryWithDefaultFinalStep()
|
||||
)
|
||||
|
||||
override val explanatoryGroup: ExplanatoryGroup.GroupTypeOption
|
||||
= ExplanatoryGroup.GroupTypeOption.create()
|
||||
override val explanatoryGroup: ExplanatoryGroup.GroupTypeOption = ExplanatoryGroup.GroupTypeOption.create()
|
||||
|
||||
override val descriptive: Descriptive.HoldsOption
|
||||
= Descriptive.HoldsOption.create()
|
||||
override val descriptive: Descriptive.HoldsOption = Descriptive.HoldsOption.create()
|
||||
|
||||
override val explanatory: Explanatory.ExplanationOption
|
||||
= Explanatory.ExplanationOption.create()
|
||||
override val explanatory: Explanatory.ExplanationOption = Explanatory.ExplanationOption.create()
|
||||
|
||||
override fun <T : AssertionGroupType> customType(groupType: T): DefaultAssertionGroupBuilderOptions<T>
|
||||
= createDescriptionAndRepresentationOption(groupType)
|
||||
override fun <T : AssertionGroupType> customType(groupType: T): DefaultAssertionGroupBuilderOptions<T> =
|
||||
createDescriptionAndRepresentationOption(groupType)
|
||||
|
||||
|
||||
private fun <T: AssertionGroupType> createDescriptionAndRepresentationOption(type: T): DefaultAssertionGroupBuilderOptions<T>
|
||||
= AssertionGroupDescriptionAndRepresentationOption.create(type, AssertionsOption.factoryWithDefaultFinalStep())
|
||||
private fun <T : AssertionGroupType> createDescriptionAndRepresentationOption(type: T): DefaultAssertionGroupBuilderOptions<T> =
|
||||
AssertionGroupDescriptionAndRepresentationOption.create(type, AssertionsOption.factoryWithDefaultFinalStep())
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ internal class AssertionsOptionImpl<out T : AssertionGroupType, R>(
|
||||
private val factory: (T, Translatable, Any, List<Assertion>) -> R
|
||||
) : AssertionsOption<T, R> {
|
||||
|
||||
override fun withAssertions(assertions: List<Assertion>): R
|
||||
= factory(groupType, description, representation, assertions)
|
||||
override fun withAssertions(assertions: List<Assertion>): R =
|
||||
factory(groupType, description, representation, assertions)
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ internal abstract class FixedClaimLikeAssertionGroupHoldsOptionImpl<T : Assertio
|
||||
override val failing: AssertionGroupDescriptionAndRepresentationOption<T, AssertionsOption<T, R>>
|
||||
get() = createDescriptionAndRepresentationOption(false)
|
||||
|
||||
override fun withClaim(holds: Boolean): AssertionGroupDescriptionAndRepresentationOption<T, AssertionsOption<T, R>>
|
||||
= createDescriptionAndRepresentationOption(holds)
|
||||
override fun withClaim(holds: Boolean): AssertionGroupDescriptionAndRepresentationOption<T, AssertionsOption<T, R>> =
|
||||
createDescriptionAndRepresentationOption(holds)
|
||||
|
||||
private fun createDescriptionAndRepresentationOption(holds: Boolean)
|
||||
= AssertionGroupDescriptionAndRepresentationOption.create(groupType, createAssertionOptionWithHolds(holds))
|
||||
private fun createDescriptionAndRepresentationOption(holds: Boolean) =
|
||||
AssertionGroupDescriptionAndRepresentationOption.create(groupType, createAssertionOptionWithHolds(holds))
|
||||
|
||||
private fun createAssertionOptionWithHolds(holds: Boolean): (T, Translatable, Any) -> AssertionsOption<T, R>
|
||||
= { t, d, r -> AssertionsOption.create(t, d, r, createFixedClaimLikeAssertionGroupFinalStep(holds)) }
|
||||
private fun createAssertionOptionWithHolds(holds: Boolean): (T, Translatable, Any) -> AssertionsOption<T, R> =
|
||||
{ t, d, r -> AssertionsOption.create(t, d, r, createFixedClaimLikeAssertionGroupFinalStep(holds)) }
|
||||
|
||||
protected abstract fun createFixedClaimLikeAssertionGroupFinalStep(
|
||||
holds: Boolean
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.assertions.builders.impl.descriptive
|
||||
|
||||
import ch.tutteli.atrium.assertions.*
|
||||
import ch.tutteli.atrium.assertions.DescriptiveAssertion
|
||||
import ch.tutteli.atrium.assertions.builders.Descriptive
|
||||
import ch.tutteli.atrium.core.trueProvider
|
||||
import ch.tutteli.atrium.creating.SubjectProvider
|
||||
@@ -46,6 +46,7 @@ internal class FinalStepImpl(
|
||||
override val representation: Any
|
||||
) : Descriptive.FinalStep {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
override fun build(): DescriptiveAssertion = BasicDescriptiveAssertion(description, representation, test)
|
||||
@Suppress("DEPRECATION" /* TODO remove annotation with 1.0.0 */)
|
||||
override fun build(): DescriptiveAssertion =
|
||||
ch.tutteli.atrium.assertions.BasicDescriptiveAssertion(description, representation, test)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
|
||||
package ch.tutteli.atrium.assertions.builders.impl.explanatory
|
||||
|
||||
import ch.tutteli.atrium.assertions.*
|
||||
import ch.tutteli.atrium.assertions.ExplanatoryAssertion
|
||||
import ch.tutteli.atrium.assertions.builders.Explanatory
|
||||
|
||||
@@ -10,9 +8,8 @@ internal object ExplanationOptionImpl : Explanatory.ExplanationOption {
|
||||
override fun withExplanation(explanation: Any?): Explanatory.FinalStep = Explanatory.FinalStep.create(explanation)
|
||||
}
|
||||
|
||||
|
||||
internal class FinalStepImpl(override val explanation: Any?) : Explanatory.FinalStep {
|
||||
|
||||
@Suppress("DEPRECATION" /* TODO remove with 1.0.0 */ )
|
||||
override fun build(): ExplanatoryAssertion = BasicExplanatoryAssertion(explanation)
|
||||
@Suppress("DEPRECATION" /* TODO remove annotation with 1.0.0 */)
|
||||
override fun build(): ExplanatoryAssertion = ch.tutteli.atrium.assertions.BasicExplanatoryAssertion(explanation)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ch.tutteli.atrium.assertions.builders.impl.fixedClaimGroup
|
||||
|
||||
import ch.tutteli.atrium.assertions.*
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
import ch.tutteli.atrium.assertions.AssertionGroupType
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
|
||||
internal data class FixedClaimAssertionGroup(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ch.tutteli.atrium.assertions.builders.impl.partiallyFixedClaimGroup
|
||||
|
||||
import ch.tutteli.atrium.assertions.*
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
import ch.tutteli.atrium.assertions.AssertionGroupType
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
|
||||
internal data class PartiallyFixedClaimAssertionGroup(
|
||||
|
||||
@@ -10,4 +10,7 @@ import ch.tutteli.atrium.checking.AssertionChecker
|
||||
*/
|
||||
@Suppress("unused" /* it's fine if we don't use AssertionBuilder */)
|
||||
val AssertionBuilder.root: DefaultAssertionGroupBuilderOptions<RootAssertionGroupType>
|
||||
get() = AssertionGroupDescriptionAndRepresentationOption.create(RootAssertionGroupType, AssertionsOption.factoryWithDefaultFinalStep())
|
||||
get() = AssertionGroupDescriptionAndRepresentationOption.create(
|
||||
RootAssertionGroupType,
|
||||
AssertionsOption.factoryWithDefaultFinalStep()
|
||||
)
|
||||
|
||||
@@ -31,8 +31,8 @@ interface AssertionPlant<out T : Any> : BaseAssertionPlant<T, AssertionPlant<T>>
|
||||
fun addAssertionsCreatedBy(assertionCreator: AssertionPlant<T>.() -> Unit): AssertionPlant<T>
|
||||
|
||||
/**
|
||||
* Creates a [DescriptiveAssertion] based on the given [description], [expected] and [test] and [adds][addAssertion] it
|
||||
* to the plant.
|
||||
* Creates a [DescriptiveAssertion] based on the given [description], [expected] and [test] and
|
||||
* [adds][addAssertion] it to the plant.
|
||||
*
|
||||
* @param description The description of the assertion, e.g., `is less than`.
|
||||
* @param expected The expected value, e.g., `5`
|
||||
@@ -43,7 +43,7 @@ interface AssertionPlant<out T : Any> : BaseAssertionPlant<T, AssertionPlant<T>>
|
||||
* @throws AssertionError Might throw an [AssertionError] in case [Assertion]s are immediately
|
||||
* evaluated (see [ReportingAssertionPlant]).
|
||||
*/
|
||||
fun createAndAddAssertion(description: Translatable, expected: Any, test: () -> Boolean): AssertionPlant<T>
|
||||
= addAssertion(assertionBuilder.createDescriptive(description, expected, test))
|
||||
fun createAndAddAssertion(description: Translatable, expected: Any, test: () -> Boolean): AssertionPlant<T> =
|
||||
addAssertion(assertionBuilder.createDescriptive(description, expected, test))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.checking.AssertionChecker
|
||||
import ch.tutteli.atrium.core.evalOnce
|
||||
import ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -7,7 +7,10 @@ import ch.tutteli.atrium.reporting.BUG_REPORT_URL
|
||||
*/
|
||||
@Deprecated("No longer required with Expect; will be removed with 1.0.0")
|
||||
class PlantHasNoSubjectException
|
||||
@Deprecated("Use the constructor without argument; will be removed with 1.0.0", ReplaceWith("PlantHasNoSubjectException()"))
|
||||
@Deprecated(
|
||||
"Use the constructor without argument; will be removed with 1.0.0",
|
||||
ReplaceWith("PlantHasNoSubjectException()")
|
||||
)
|
||||
constructor(message: String) : RuntimeException(message) {
|
||||
|
||||
@Suppress("DEPRECATION" /* TODO remove with 1.0.0 */)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.core.None
|
||||
import ch.tutteli.atrium.core.Option
|
||||
import ch.tutteli.atrium.core.Some
|
||||
import ch.tutteli.atrium.core.None
|
||||
|
||||
/**
|
||||
* Provides the subject of an [Assertion].
|
||||
|
||||
@@ -97,7 +97,11 @@ interface AssertionFormatter {
|
||||
* It itself expects a [AssertionFormatterParameterObject] which is used for the child assertions and a function
|
||||
* which formats the child [Assertion]s in the context of the given [assertionGroup].
|
||||
*/
|
||||
fun formatGroup(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject, formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit)
|
||||
fun formatGroup(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit
|
||||
)
|
||||
|
||||
companion object {
|
||||
val CALL_FORMAT_GROUP = "do not use `${AssertionFormatter::format.name}` for " +
|
||||
|
||||
@@ -2,8 +2,8 @@ package ch.tutteli.atrium.reporting
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
import ch.tutteli.atrium.assertions.InvisibleAssertionGroupType
|
||||
import ch.tutteli.atrium.assertions.ExplanatoryAssertionGroupType
|
||||
import ch.tutteli.atrium.assertions.InvisibleAssertionGroupType
|
||||
import ch.tutteli.atrium.core.CoreFactory
|
||||
|
||||
/**
|
||||
@@ -52,8 +52,8 @@ interface AssertionFormatterController {
|
||||
*
|
||||
* @return `true` if it is an explanatory assertion group; `false` otherwise.
|
||||
*/
|
||||
fun isExplanatoryAssertionGroup(assertion: Assertion)
|
||||
= assertion is AssertionGroup && assertion.type is ExplanatoryAssertionGroupType
|
||||
fun isExplanatoryAssertionGroup(assertion: Assertion) =
|
||||
assertion is AssertionGroup && assertion.type is ExplanatoryAssertionGroupType
|
||||
|
||||
companion object {
|
||||
/**
|
||||
|
||||
@@ -54,8 +54,14 @@ class AssertionFormatterParameterObject private constructor(
|
||||
*
|
||||
* @return The newly created [AssertionFormatterParameterObject].
|
||||
*/
|
||||
fun createChildWithNewPrefixAndAdditionalIndent(newPrefix: String, additionalIndent: Int)
|
||||
= AssertionFormatterParameterObject(sb, newPrefix, indentLevel + prefix.length + additionalIndent, assertionFilter, numberOfDoNotFilterGroups)
|
||||
fun createChildWithNewPrefixAndAdditionalIndent(newPrefix: String, additionalIndent: Int) =
|
||||
AssertionFormatterParameterObject(
|
||||
sb,
|
||||
newPrefix,
|
||||
indentLevel + prefix.length + additionalIndent,
|
||||
assertionFilter,
|
||||
numberOfDoNotFilterGroups
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
@@ -65,8 +71,8 @@ class AssertionFormatterParameterObject private constructor(
|
||||
*
|
||||
* @return The newly created [AssertionFormatterParameterObject].
|
||||
*/
|
||||
fun createForDoNotFilterAssertionGroup(): AssertionFormatterParameterObject
|
||||
= AssertionFormatterParameterObject(sb, prefix, indentLevel, assertionFilter, numberOfDoNotFilterGroups + 1)
|
||||
fun createForDoNotFilterAssertionGroup(): AssertionFormatterParameterObject =
|
||||
AssertionFormatterParameterObject(sb, prefix, indentLevel, assertionFilter, numberOfDoNotFilterGroups + 1)
|
||||
|
||||
/**
|
||||
* Indicates that the formatting process is currently not formatting the [Assertion]s (or any nested assertion)
|
||||
|
||||
@@ -18,7 +18,11 @@ interface AssertionPairFormatter {
|
||||
* @param assertionGroup The [AssertionGroup] of which we want to format the header.
|
||||
* @param newParameterObject The [AssertionFormatterParameterObject] used for the [AssertionGroup.assertions].
|
||||
*/
|
||||
fun formatGroupHeader(parameterObject: AssertionFormatterParameterObject, assertionGroup: AssertionGroup, newParameterObject: AssertionFormatterParameterObject)
|
||||
fun formatGroupHeader(
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
assertionGroup: AssertionGroup,
|
||||
newParameterObject: AssertionFormatterParameterObject
|
||||
)
|
||||
|
||||
/**
|
||||
* Formats the assertion pair consisting of the given [translatable] and the given [representation]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ch.tutteli.atrium.reporting
|
||||
|
||||
import ch.tutteli.atrium.reporting.translating.Untranslatable
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
import ch.tutteli.atrium.reporting.translating.Untranslatable
|
||||
|
||||
/**
|
||||
* Refers to the bug tracker of Atrium.
|
||||
@@ -11,7 +11,8 @@ const val BUG_REPORT_URL = "https://github.com/robstoll/atrium/issues/new"
|
||||
/**
|
||||
* Can be used in places where an argument for reporting is expected which should never be shown to the user.
|
||||
*/
|
||||
const val SHOULD_NOT_BE_SHOWN_TO_THE_USER_BUG = "Should not be shown to the user; if you see this, please file a bug report at $BUG_REPORT_URL"
|
||||
const val SHOULD_NOT_BE_SHOWN_TO_THE_USER_BUG =
|
||||
"Should not be shown to the user; if you see this, please file a bug report at $BUG_REPORT_URL"
|
||||
|
||||
/**
|
||||
* Can be used in places where an argument of type [Translatable] is expected which should never be shown to the user.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ch.tutteli.atrium.reporting.translating
|
||||
|
||||
import ch.tutteli.kbox.forElementAndForEachIn
|
||||
import ch.tutteli.atrium.core.polyfills.format
|
||||
import ch.tutteli.kbox.forElementAndForEachIn
|
||||
|
||||
/**
|
||||
* Represents a [Translator] which supports [TranslatableWithArgs].
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ch.tutteli.atrium.reporting.translating
|
||||
|
||||
import ch.tutteli.atrium.core.CoreFactory
|
||||
|
||||
/**
|
||||
* Responsible to decide in which order [Locale]s should be processed.
|
||||
*
|
||||
|
||||
@@ -60,19 +60,17 @@ class TranslatableWithArgs constructor(val translatable: Translatable, val argum
|
||||
|
||||
companion object {
|
||||
|
||||
private fun createList(arg: Any): List<Any>
|
||||
= ArrayList<Any>(1).apply {
|
||||
private fun createList(arg: Any): List<Any> = ArrayList<Any>(1).apply {
|
||||
add(arg)
|
||||
}
|
||||
|
||||
private fun createList(arg1: Any, arg2: Any): List<Any>
|
||||
= ArrayList<Any>(2).apply {
|
||||
private fun createList(arg1: Any, arg2: Any): List<Any> = ArrayList<Any>(2).apply {
|
||||
add(arg1)
|
||||
add(arg2)
|
||||
}
|
||||
|
||||
private fun createList(arg1: Any, arg2: Any, otherArgs: Array<out Any>): List<Any>
|
||||
= ArrayList<Any>(2 + otherArgs.size).apply {
|
||||
private fun createList(arg1: Any, arg2: Any, otherArgs: Array<out Any>): List<Any> =
|
||||
ArrayList<Any>(2 + otherArgs.size).apply {
|
||||
add(arg1)
|
||||
add(arg2)
|
||||
addAll(otherArgs)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package ch.tutteli.atrium.reporting.translating
|
||||
|
||||
import ch.tutteli.atrium.core.polyfills.format
|
||||
|
||||
/**
|
||||
* This translator does not translate but uses [Translatable.getDefault] instead
|
||||
* and uses [getDefaultLocale] as [primaryLocale] if not defined differently via constructor parameter.
|
||||
|
||||
@@ -2,7 +2,7 @@ package ch.tutteli.atrium.core
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.checking.AssertionChecker
|
||||
import ch.tutteli.atrium.creating.*
|
||||
import ch.tutteli.atrium.creating.ReportingAssertionPlantNullable
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
import ch.tutteli.atrium.reporting.Reporter
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
@@ -18,17 +18,17 @@ actual interface CoreFactory : CoreFactoryCommon {
|
||||
* Creates a [ReportingAssertionPlantNullable] which is the entry point for assertions about nullable types.
|
||||
*
|
||||
* It creates a [newThrowingAssertionChecker] based on the given [reporter] for assertion checking,
|
||||
* uses [subjectProvider] as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* uses [subjectProvider] as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* Notice, this method will be moved to [CoreFactoryCommon] with 1.0.0.
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* (see [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param reporter The reporter which will be used for a [newThrowingAssertionChecker].
|
||||
*
|
||||
*
|
||||
@@ -55,19 +55,19 @@ actual interface CoreFactory : CoreFactoryCommon {
|
||||
* Creates a [ReportingAssertionPlantNullable] which is the entry point for assertions about nullable types.
|
||||
*
|
||||
* It uses the given [assertionChecker] for assertion checking, uses [subjectProvider] as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* Notice, this method will be moved to [CoreFactoryCommon] with 1.0.0.
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* (see [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param assertionChecker The checker which will be used to check [Assertion]s.
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionChecker]).
|
||||
* (see [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.assertionChecker]).
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ actual class AtriumError internal actual constructor(message: String) : Assertio
|
||||
*
|
||||
* @return The newly created [AtriumError]
|
||||
*/
|
||||
actual fun create(message: String, atriumErrorAdjuster: AtriumErrorAdjuster): AtriumError
|
||||
= createAtriumError(message, atriumErrorAdjuster)
|
||||
actual fun create(message: String, atriumErrorAdjuster: AtriumErrorAdjuster): AtriumError =
|
||||
createAtriumError(message, atriumErrorAdjuster)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /*TODO remove with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.core.polyfills
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -2,7 +2,7 @@ package ch.tutteli.atrium.core
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.checking.AssertionChecker
|
||||
import ch.tutteli.atrium.creating.*
|
||||
import ch.tutteli.atrium.creating.ReportingAssertionPlantNullable
|
||||
import ch.tutteli.atrium.reporting.AssertionFormatterFacade
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
import ch.tutteli.atrium.reporting.Reporter
|
||||
@@ -44,17 +44,17 @@ actual interface CoreFactory : CoreFactoryCommon {
|
||||
* Creates a [ReportingAssertionPlantNullable] which is the entry point for assertions about nullable types.
|
||||
*
|
||||
* It creates a [newThrowingAssertionChecker] based on the given [reporter] for assertion checking,
|
||||
* uses [subjectProvider] as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* uses [subjectProvider] as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* Notice, this method will be moved to [CoreFactoryCommon] with 1.0.0.
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* (see [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* also as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param reporter The reporter which will be used for a [newThrowingAssertionChecker].
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
@@ -80,19 +80,19 @@ actual interface CoreFactory : CoreFactoryCommon {
|
||||
* Creates a [ReportingAssertionPlantNullable] which is the entry point for assertions about nullable types.
|
||||
*
|
||||
* It uses the given [assertionChecker] for assertion checking, uses [subjectProvider] as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* Notice, this method will be moved to [CoreFactoryCommon] with 1.0.0.
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* (see [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param assertionChecker The checker which will be used to check [Assertion]s.
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionChecker]).
|
||||
* (see [ch.tutteli.atrium.creating.AssertionPlantWithCommonFields.CommonFields.assertionChecker]).
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@@ -112,6 +112,4 @@ actual interface CoreFactory : CoreFactoryCommon {
|
||||
): ReportingAssertionPlantNullable<T> = newReportingPlantNullableFromCommon(
|
||||
assertionVerb, subjectProvider, assertionChecker, nullRepresentation
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ import ch.tutteli.kbox.blankToNull
|
||||
|
||||
@Suppress("DeprecatedCallableAddReplaceWith")
|
||||
@Deprecated("Only here to ease migration, use Atrium's Locale directly; will be removed with 1.0.0")
|
||||
fun java.util.Locale.toAtriumLocale(): Locale
|
||||
= ch.tutteli.atrium.reporting.translating.Locale(
|
||||
fun java.util.Locale.toAtriumLocale(): Locale = ch.tutteli.atrium.reporting.translating.Locale(
|
||||
language,
|
||||
script.blankToNull(),
|
||||
country.blankToNull(),
|
||||
|
||||
@@ -2,7 +2,6 @@ package ch.tutteli.atrium.core.polyfills
|
||||
|
||||
import ch.tutteli.atrium.reporting.translating.Locale
|
||||
import ch.tutteli.atrium.reporting.translating.toJavaLocale
|
||||
import kotlin.String
|
||||
|
||||
actual fun String.format(locale: Locale, arg: Any, vararg otherArgs: Any): String {
|
||||
return java.lang.String.format(locale.toJavaLocale(), this, arg, *otherArgs)
|
||||
|
||||
@@ -18,7 +18,7 @@ actual class AtriumError internal actual constructor(message: String) : Assertio
|
||||
* * Creates an [AtriumError] and adjusts it with the given [atriumErrorAdjuster] before it is returned
|
||||
* (adjusting might filter the [stackTrace]).
|
||||
*/
|
||||
actual fun create(message: String, atriumErrorAdjuster: AtriumErrorAdjuster): AtriumError
|
||||
= createAtriumError(message, atriumErrorAdjuster)
|
||||
actual fun create(message: String, atriumErrorAdjuster: AtriumErrorAdjuster): AtriumError =
|
||||
createAtriumError(message, atriumErrorAdjuster)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ class FeatureAssertionChecker(private val originalAssertionHolder: AssertionHold
|
||||
* @throws AssertionError Might throw an [AssertionError] in case one of the given [assertions] does not hold.
|
||||
*/
|
||||
override fun check(assertionVerb: Translatable, representation: Any?, assertions: List<Assertion>) {
|
||||
originalAssertionHolder.addAssertion(assertionBuilder.feature
|
||||
originalAssertionHolder.addAssertion(
|
||||
assertionBuilder.feature
|
||||
.withDescriptionAndRepresentation(assertionVerb, representation)
|
||||
.withAssertions(ArrayList(assertions))
|
||||
.build()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.core.robstoll.lib.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.core.robstoll.lib.creating
|
||||
|
||||
import ch.tutteli.atrium.creating.AssertionPlant
|
||||
|
||||
@@ -17,9 +17,9 @@ import ch.tutteli.atrium.reporting.AssertionFormatterParameterObject
|
||||
class AssertionFormatterControllerBasedFacade(private val assertionFormatterController: AssertionFormatterController) :
|
||||
AssertionFormatterFacade {
|
||||
|
||||
override fun format(assertion: Assertion, sb: StringBuilder, assertionFilter: (Assertion) -> Boolean)
|
||||
= assertionFormatterController.format(assertion, AssertionFormatterParameterObject.new(sb, assertionFilter))
|
||||
override fun format(assertion: Assertion, sb: StringBuilder, assertionFilter: (Assertion) -> Boolean) =
|
||||
assertionFormatterController.format(assertion, AssertionFormatterParameterObject.new(sb, assertionFilter))
|
||||
|
||||
override fun register(assertionFormatterFactory: (AssertionFormatterController) -> AssertionFormatter)
|
||||
= assertionFormatterController.register(assertionFormatterFactory(assertionFormatterController))
|
||||
override fun register(assertionFormatterFactory: (AssertionFormatterController) -> AssertionFormatter) =
|
||||
assertionFormatterController.register(assertionFormatterFactory(assertionFormatterController))
|
||||
}
|
||||
|
||||
@@ -38,8 +38,15 @@ class AssertionFormatterControllerImpl : AssertionFormatterController {
|
||||
&& !parameterObject.assertionFilter(assertion)
|
||||
}
|
||||
|
||||
private fun formatGroup(assertionGroup: AssertionGroup, assertionFormatter: AssertionFormatter, parameterObject: AssertionFormatterParameterObject) {
|
||||
assertionFormatter.formatGroup(assertionGroup, parameterObject) { childParameterObject, formatAssertionInGroup ->
|
||||
private fun formatGroup(
|
||||
assertionGroup: AssertionGroup,
|
||||
assertionFormatter: AssertionFormatter,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
) {
|
||||
assertionFormatter.formatGroup(
|
||||
assertionGroup,
|
||||
parameterObject
|
||||
) { childParameterObject, formatAssertionInGroup ->
|
||||
assertionGroup.assertions
|
||||
.filter { !noNeedToFormat(it, childParameterObject) }
|
||||
.forEach { formatChild(it, formatAssertionInGroup) }
|
||||
|
||||
@@ -29,7 +29,10 @@ abstract class NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<in T :
|
||||
) : SingleAssertionGroupTypeFormatter<T>(clazz) {
|
||||
|
||||
|
||||
override fun formatGroupAssertions(formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit, childParameterObject: AssertionFormatterParameterObject) {
|
||||
override fun formatGroupAssertions(
|
||||
formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit,
|
||||
childParameterObject: AssertionFormatterParameterObject
|
||||
) {
|
||||
formatAssertions(childParameterObject) {
|
||||
assertionFormatterController.format(it, childParameterObject)
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ class OnlyFailureReporter(
|
||||
* Formats the given [assertion] with the help of the defined [assertionFormatterFacade]
|
||||
* and appends the result to the given [sb] but only in case the given [assertion] [holds][Assertion.holds].
|
||||
*/
|
||||
override fun format(assertion: Assertion, sb: StringBuilder)
|
||||
= assertionFormatterFacade.format(assertion, sb, this::assertionFilter)
|
||||
override fun format(assertion: Assertion, sb: StringBuilder) =
|
||||
assertionFormatterFacade.format(assertion, sb, this::assertionFilter)
|
||||
|
||||
private fun assertionFilter(assertion: Assertion) = !assertion.holds()
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ abstract class SingleAssertionGroupTypeFormatter<in T : AssertionGroupType>(
|
||||
* Returns true if the given [assertion] is an [AssertionGroup] and its [type][AssertionGroup.type]
|
||||
* is [T] or a sub type.
|
||||
*/
|
||||
final override fun canFormat(assertion: Assertion)
|
||||
= assertion is AssertionGroup && clazz.isInstance(assertion.type)
|
||||
final override fun canFormat(assertion: Assertion) = assertion is AssertionGroup && clazz.isInstance(assertion.type)
|
||||
|
||||
/**
|
||||
* Always throws an [UnsupportedOperationException], because this [AssertionFormatter] can only format
|
||||
@@ -38,8 +37,10 @@ abstract class SingleAssertionGroupTypeFormatter<in T : AssertionGroupType>(
|
||||
*
|
||||
* @throws UnsupportedOperationException always!
|
||||
*/
|
||||
final override fun formatNonGroup(assertion: Assertion, parameterObject: AssertionFormatterParameterObject)
|
||||
= throw UnsupportedOperationException("supports only ${clazz.fullName} for which one has to call ${AssertionFormatter::formatGroup.name}")
|
||||
final override fun formatNonGroup(assertion: Assertion, parameterObject: AssertionFormatterParameterObject) =
|
||||
throw UnsupportedOperationException(
|
||||
"supports only ${clazz.fullName} for which one has to call ${AssertionFormatter::formatGroup.name}"
|
||||
)
|
||||
|
||||
/**
|
||||
* Checks whether [assertionGroup] is [T] or a sub type and if so, calls [formatGroupHeaderAndGetChildParameterObject]
|
||||
@@ -59,12 +60,20 @@ abstract class SingleAssertionGroupTypeFormatter<in T : AssertionGroupType>(
|
||||
*
|
||||
* @throws UnsupportedOperationException if the given [assertionGroup] is not [T] or a sub type of it.
|
||||
*/
|
||||
final override fun formatGroup(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject, formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit) = when {
|
||||
final override fun formatGroup(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit
|
||||
) = when {
|
||||
clazz.isInstance(assertionGroup.type) -> formatSpecificGroup(assertionGroup, parameterObject, formatAssertions)
|
||||
else -> throw UnsupportedOperationException("supports only ${clazz.fullName}")
|
||||
}
|
||||
|
||||
private fun formatSpecificGroup(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject, formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit) {
|
||||
private fun formatSpecificGroup(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit
|
||||
) {
|
||||
val childParameterObject = formatGroupHeaderAndGetChildParameterObject(assertionGroup, parameterObject)
|
||||
formatGroupAssertions(formatAssertions, childParameterObject)
|
||||
}
|
||||
@@ -80,7 +89,10 @@ abstract class SingleAssertionGroupTypeFormatter<in T : AssertionGroupType>(
|
||||
*
|
||||
* @return The [AssertionFormatterParameterObject] which shall be used for the [AssertionGroup.assertions].
|
||||
*/
|
||||
protected abstract fun formatGroupHeaderAndGetChildParameterObject(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject): AssertionFormatterParameterObject
|
||||
protected abstract fun formatGroupHeaderAndGetChildParameterObject(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject
|
||||
|
||||
/**
|
||||
* Formats the [AssertionGroup.assertions] -- has to call the given [formatAssertions] function in order that
|
||||
@@ -92,5 +104,8 @@ abstract class SingleAssertionGroupTypeFormatter<in T : AssertionGroupType>(
|
||||
* @param childParameterObject The parameter object which shall be used to format [AssertionGroup.assertions] -- contains
|
||||
* inter alia the [sb][AssertionFormatterParameterObject.sb] to which the result will be appended.
|
||||
*/
|
||||
protected abstract fun formatGroupAssertions(formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit, childParameterObject: AssertionFormatterParameterObject)
|
||||
protected abstract fun formatGroupAssertions(
|
||||
formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit,
|
||||
childParameterObject: AssertionFormatterParameterObject
|
||||
)
|
||||
}
|
||||
|
||||
@@ -36,11 +36,17 @@ import kotlin.reflect.KClass
|
||||
class TextExplanatoryAssertionGroupFormatter(
|
||||
bulletPoints: Map<KClass<out BulletPointIdentifier>, String>,
|
||||
assertionFormatterController: AssertionFormatterController
|
||||
) : NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<ExplanatoryAssertionGroupType>(ExplanatoryAssertionGroupType::class, assertionFormatterController) {
|
||||
) : NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<ExplanatoryAssertionGroupType>(
|
||||
ExplanatoryAssertionGroupType::class,
|
||||
assertionFormatterController
|
||||
) {
|
||||
private val explanatoryBulletPoint = bulletPoints[ExplanatoryAssertionGroupType::class] ?: "» "
|
||||
private val warningBulletPoint = bulletPoints[WarningAssertionGroupType::class] ?: "❗❗ "
|
||||
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject): AssertionFormatterParameterObject {
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject {
|
||||
val bulletPoint = when (assertionGroup.type) {
|
||||
WarningAssertionGroupType -> warningBulletPoint
|
||||
else -> explanatoryBulletPoint
|
||||
|
||||
@@ -59,20 +59,31 @@ class TextFallbackAssertionFormatter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun appendDescriptiveAssertion(basicAssertion: DescriptiveAssertion, parameterObject: AssertionFormatterParameterObject) {
|
||||
private fun appendDescriptiveAssertion(
|
||||
basicAssertion: DescriptiveAssertion,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
) {
|
||||
assertionPairFormatter.format(parameterObject, basicAssertion.description, basicAssertion.representation)
|
||||
}
|
||||
|
||||
private fun appendExplanatoryAssertion(assertion: ExplanatoryAssertion, parameterObject: AssertionFormatterParameterObject) {
|
||||
private fun appendExplanatoryAssertion(
|
||||
assertion: ExplanatoryAssertion,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
) {
|
||||
parameterObject.sb.append(objectFormatter.format(assertion.explanation))
|
||||
}
|
||||
|
||||
private fun formatFallback(assertion: Assertion, parameterObject: AssertionFormatterParameterObject) {
|
||||
val translatable = Untranslatable("Unsupported type ${assertion::class.fullName}, can only report whether it holds")
|
||||
val translatable =
|
||||
Untranslatable("Unsupported type ${assertion::class.fullName}, can only report whether it holds")
|
||||
assertionPairFormatter.format(parameterObject, translatable, assertion.holds())
|
||||
}
|
||||
|
||||
override fun formatGroup(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject, formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit) {
|
||||
override fun formatGroup(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit
|
||||
) {
|
||||
val childParameterObject = formatGroupHeaderAndGetChildParameterObject(assertionGroup, parameterObject)
|
||||
formatAssertions(childParameterObject) {
|
||||
assertionFormatterController.format(it, childParameterObject)
|
||||
@@ -82,7 +93,9 @@ class TextFallbackAssertionFormatter(
|
||||
private fun formatGroupHeaderAndGetChildParameterObject(
|
||||
assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject
|
||||
) = when (assertionGroup.type) {
|
||||
RootAssertionGroupType -> formatter.formatAfterAppendLnEtc(assertionPairFormatter, assertionGroup, parameterObject)
|
||||
RootAssertionGroupType -> formatter.formatAfterAppendLnEtc(
|
||||
assertionPairFormatter, assertionGroup, parameterObject
|
||||
)
|
||||
else -> formatter.formatWithGroupName(assertionPairFormatter, assertionGroup, parameterObject)
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,18 @@ class TextFeatureAssertionGroupFormatter(
|
||||
bulletPoints: Map<KClass<out BulletPointIdentifier>, String>,
|
||||
assertionFormatterController: AssertionFormatterController,
|
||||
private val assertionPairFormatter: AssertionPairFormatter
|
||||
) : NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<FeatureAssertionGroupType>(FeatureAssertionGroupType::class, assertionFormatterController) {
|
||||
) : NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<FeatureAssertionGroupType>(
|
||||
FeatureAssertionGroupType::class,
|
||||
assertionFormatterController
|
||||
) {
|
||||
|
||||
private val prefix = (bulletPoints[FeatureAssertionGroupType::class] ?: "◾ ")
|
||||
private val arrow = (bulletPoints[PrefixFeatureAssertionGroupHeader::class] ?: "▶ ")
|
||||
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject): AssertionFormatterParameterObject {
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject {
|
||||
parameterObject.appendLnIndentAndPrefix()
|
||||
val translatable = TranslatableWithArgs(Untranslatable("$arrow%s"), assertionGroup.description)
|
||||
val group =
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* TODO remove with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.core.robstoll.lib.reporting
|
||||
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
@@ -31,9 +32,14 @@ import kotlin.reflect.KClass
|
||||
class TextIndentAssertionGroupFormatter(
|
||||
bulletPoints: Map<KClass<out BulletPointIdentifier>, String>,
|
||||
assertionFormatterController: AssertionFormatterController
|
||||
) : NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<IndentAssertionGroupType>(IndentAssertionGroupType::class, assertionFormatterController) {
|
||||
) : NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<IndentAssertionGroupType>(
|
||||
IndentAssertionGroupType::class,
|
||||
assertionFormatterController
|
||||
) {
|
||||
private val bulletPoint = bulletPoints[IndentAssertionGroupType::class] ?: " ⋄ "
|
||||
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject)
|
||||
= parameterObject.createChildWithNewPrefix(bulletPoint)
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject = parameterObject.createChildWithNewPrefix(bulletPoint)
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ abstract class TextListBasedAssertionGroupFormatter<in T : AssertionGroupType>(
|
||||
private val formatter =
|
||||
TextPrefixBasedAssertionGroupFormatter(bulletPoint)
|
||||
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject)
|
||||
= formatter.formatWithGroupName(assertionPairFormatter, assertionGroup, parameterObject)
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject =
|
||||
formatter.formatWithGroupName(assertionPairFormatter, assertionGroup, parameterObject)
|
||||
}
|
||||
|
||||
@@ -30,13 +30,24 @@ class TextNextLineAssertionPairFormatter(
|
||||
private val translator: Translator
|
||||
) : AssertionPairFormatter {
|
||||
|
||||
override fun formatGroupHeader(parameterObject: AssertionFormatterParameterObject, assertionGroup: AssertionGroup, newParameterObject: AssertionFormatterParameterObject)
|
||||
= format(parameterObject, assertionGroup.description, assertionGroup.representation, newParameterObject)
|
||||
override fun formatGroupHeader(
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
assertionGroup: AssertionGroup,
|
||||
newParameterObject: AssertionFormatterParameterObject
|
||||
): Unit = format(parameterObject, assertionGroup.description, assertionGroup.representation, newParameterObject)
|
||||
|
||||
override fun format(parameterObject: AssertionFormatterParameterObject, translatable: Translatable, representation: Any)
|
||||
= format(parameterObject, translatable, representation, parameterObject)
|
||||
override fun format(
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
translatable: Translatable,
|
||||
representation: Any
|
||||
): Unit = format(parameterObject, translatable, representation, parameterObject)
|
||||
|
||||
private fun format(parameterObject: AssertionFormatterParameterObject, translatable: Translatable, representation: Any, newParameterObject: AssertionFormatterParameterObject) {
|
||||
private fun format(
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
translatable: Translatable,
|
||||
representation: Any,
|
||||
newParameterObject: AssertionFormatterParameterObject
|
||||
) {
|
||||
parameterObject.sb.append(translator.translate(translatable)).append(":")
|
||||
if (representation !is RawString || representation != RawString.EMPTY) {
|
||||
newParameterObject.appendLnAndIndent()
|
||||
|
||||
@@ -7,12 +7,20 @@ import ch.tutteli.atrium.reporting.AssertionPairFormatter
|
||||
class TextPrefixBasedAssertionGroupFormatter(
|
||||
private val prefix: String
|
||||
) {
|
||||
fun formatWithGroupName(assertionPairFormatter: AssertionPairFormatter, assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject): AssertionFormatterParameterObject {
|
||||
fun formatWithGroupName(
|
||||
assertionPairFormatter: AssertionPairFormatter,
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject {
|
||||
parameterObject.appendLnIndentAndPrefix()
|
||||
return formatAfterAppendLnEtc(assertionPairFormatter, assertionGroup, parameterObject)
|
||||
}
|
||||
|
||||
fun formatAfterAppendLnEtc(assertionPairFormatter: AssertionPairFormatter, assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject): AssertionFormatterParameterObject {
|
||||
fun formatAfterAppendLnEtc(
|
||||
assertionPairFormatter: AssertionPairFormatter,
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject {
|
||||
val newParameterObject = parameterObject.createChildWithNewPrefix(prefix)
|
||||
assertionPairFormatter.formatGroupHeader(parameterObject, assertionGroup, newParameterObject)
|
||||
return newParameterObject
|
||||
|
||||
@@ -28,10 +28,18 @@ class TextSameLineAssertionPairFormatter(
|
||||
private val translator: Translator
|
||||
) : AssertionPairFormatter {
|
||||
|
||||
override fun formatGroupHeader(parameterObject: AssertionFormatterParameterObject, assertionGroup: AssertionGroup, newParameterObject: AssertionFormatterParameterObject)
|
||||
= format(parameterObject, assertionGroup.description, assertionGroup.representation)
|
||||
override fun formatGroupHeader(
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
assertionGroup: AssertionGroup,
|
||||
newParameterObject: AssertionFormatterParameterObject
|
||||
): Unit = format(parameterObject, assertionGroup.description, assertionGroup.representation)
|
||||
|
||||
override fun format(parameterObject: AssertionFormatterParameterObject, translatable: Translatable, representation: Any) {
|
||||
parameterObject.sb.append(translator.translate(translatable)).append(": ").append(objectFormatter.format(representation))
|
||||
override fun format(
|
||||
parameterObject: AssertionFormatterParameterObject,
|
||||
translatable: Translatable,
|
||||
representation: Any
|
||||
) {
|
||||
parameterObject.sb.append(translator.translate(translatable)).append(": ")
|
||||
.append(objectFormatter.format(representation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,14 +36,20 @@ class TextSummaryAssertionGroupFormatter(
|
||||
private val successful = (bulletPoints[PrefixSuccessfulSummaryAssertion::class] ?: "✔ ")
|
||||
private val failing = (bulletPoints[PrefixFailingSummaryAssertion::class] ?: "✘ ")
|
||||
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject): AssertionFormatterParameterObject {
|
||||
override fun formatGroupHeaderAndGetChildParameterObject(
|
||||
assertionGroup: AssertionGroup,
|
||||
parameterObject: AssertionFormatterParameterObject
|
||||
): AssertionFormatterParameterObject {
|
||||
parameterObject.appendLnIndentAndPrefix()
|
||||
assertionPairFormatter.format(parameterObject, assertionGroup.description, assertionGroup.representation)
|
||||
//the prefix which should be used for assertions is defined in the formatGroupAssertions
|
||||
return parameterObject.createForDoNotFilterAssertionGroup()
|
||||
}
|
||||
|
||||
override fun formatGroupAssertions(formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit, childParameterObject: AssertionFormatterParameterObject) {
|
||||
override fun formatGroupAssertions(
|
||||
formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit,
|
||||
childParameterObject: AssertionFormatterParameterObject
|
||||
) {
|
||||
val successfulParameterObject = childParameterObject.createChildWithNewPrefix(successful)
|
||||
val failingParameterObject = childParameterObject.createChildWithNewPrefix(failing)
|
||||
formatAssertions(childParameterObject) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package ch.tutteli.atrium.core.robstoll.lib.reporting
|
||||
|
||||
import ch.tutteli.atrium.reporting.LazyRepresentation
|
||||
import ch.tutteli.atrium.reporting.ObjectFormatter
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
import ch.tutteli.atrium.reporting.StringBasedRawString
|
||||
import ch.tutteli.atrium.reporting.LazyRepresentation
|
||||
import ch.tutteli.atrium.reporting.translating.TranslatableBasedRawString
|
||||
import ch.tutteli.atrium.reporting.translating.Translator
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@@ -8,6 +8,7 @@ actual class RemoveRunnerAtriumErrorAdjuster : FilterAtriumErrorAdjuster(), Atri
|
||||
stackTrace.takeWhile {
|
||||
!it.className.startsWith("org.junit") &&
|
||||
!it.className.startsWith("org.jetbrains.spek") &&
|
||||
!it.className.startsWith("org.spekframework.spek2") &&
|
||||
!it.className.startsWith("io.kotlintest")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ internal class ResourceBundleBasedTranslator(
|
||||
* [primaryLocale] or one of its secondary alternatives -- the [fallbackLocales] are used in the
|
||||
* given order.
|
||||
*/
|
||||
fun create(primaryLocale: Locale, vararg fallbackLocales: Locale)
|
||||
= ResourceBundleBasedTranslator(primaryLocale, fallbackLocales.toList())
|
||||
fun create(primaryLocale: Locale, vararg fallbackLocales: Locale) =
|
||||
ResourceBundleBasedTranslator(primaryLocale, fallbackLocales.toList())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ abstract class CoreFactoryCommonImpl : CoreFactoryCommon {
|
||||
|
||||
final override fun newLocaleOrderDecider(): LocaleOrderDecider = CoroutineBasedLocaleOrderDecider()
|
||||
|
||||
final override fun newDetailedObjectFormatter(
|
||||
translator: Translator): ObjectFormatter = DetailedObjectFormatter(translator)
|
||||
final override fun newDetailedObjectFormatter(translator: Translator): ObjectFormatter =
|
||||
DetailedObjectFormatter(translator)
|
||||
|
||||
final override fun newAssertionFormatterController(): AssertionFormatterController =
|
||||
AssertionFormatterControllerImpl()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.core.robstoll
|
||||
|
||||
import ch.tutteli.atrium.core.polyfills.registerService
|
||||
|
||||
@@ -7,8 +7,8 @@ import ch.tutteli.atrium.reporting.Reporter
|
||||
import ch.tutteli.atrium.reporting.translating.TranslationSupplier
|
||||
|
||||
class CoreFactoryImpl : CoreFactoryCommonImpl(), CoreFactory {
|
||||
override fun newOnlyFailureReporter(assertionFormatterFacade: AssertionFormatterFacade): Reporter
|
||||
= newOnlyFailureReporter(assertionFormatterFacade, newNoOpAtriumErrorAdjuster())
|
||||
override fun newOnlyFailureReporter(assertionFormatterFacade: AssertionFormatterFacade): Reporter =
|
||||
newOnlyFailureReporter(assertionFormatterFacade, newNoOpAtriumErrorAdjuster())
|
||||
|
||||
override fun newPropertiesBasedTranslationSupplier(): TranslationSupplier =
|
||||
PropertiesPerEntityAndLocaleTranslationSupplier()
|
||||
|
||||
@@ -2,7 +2,6 @@ package ch.tutteli.atrium.domain.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.core.polyfills.loadSingleService
|
||||
import ch.tutteli.atrium.creating.AssertionPlant
|
||||
import ch.tutteli.atrium.creating.SubjectProvider
|
||||
|
||||
/**
|
||||
@@ -21,5 +20,7 @@ interface ComparableAssertions {
|
||||
fun <T1 : Comparable<T2>, T2 : Any?> isLessThan(subjectProvider: SubjectProvider<T1>, expected: T2): Assertion
|
||||
fun <T1 : Comparable<T2>, T2 : Any?> isLessOrEquals(subjectProvider: SubjectProvider<T1>, expected: T2): Assertion
|
||||
fun <T1 : Comparable<T2>, T2 : Any?> isGreaterThan(subjectProvider: SubjectProvider<T1>, expected: T2): Assertion
|
||||
fun <T1 : Comparable<T2>, T2: Any?> isGreaterOrEquals(subjectProvider: SubjectProvider<T1>, expected: T2): Assertion
|
||||
fun <T1 : Comparable<T2>, T2 : Any?> isGreaterOrEquals(
|
||||
subjectProvider: SubjectProvider<T1>, expected: T2
|
||||
): Assertion
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package ch.tutteli.atrium.domain.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.core.polyfills.loadSingleService
|
||||
import ch.tutteli.atrium.creating.AssertionPlant
|
||||
import ch.tutteli.atrium.creating.SubjectProvider
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,8 +36,10 @@ interface MapEntryAssertions {
|
||||
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
fun <K : Any, V : Any> isKeyValue(plant: AssertionPlant<Map.Entry<K, V>>, key: K, value: V): Assertion
|
||||
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
fun <K : Any> key(plant: AssertionPlant<Map.Entry<K, *>>, assertionCreator: AssertionPlant<K>.() -> Unit): Assertion
|
||||
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
fun <V : Any> value(
|
||||
plant: AssertionPlant<Map.Entry<*, V>>,
|
||||
|
||||
@@ -26,10 +26,19 @@ interface PairAssertions {
|
||||
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
fun <K : Any> first(plant: AssertionPlant<Pair<K, *>>, assertionCreator: AssertionPlant<K>.() -> Unit): Assertion
|
||||
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
fun <V : Any> second(plant: AssertionPlant<Pair<*, V>>, assertionCreator: AssertionPlant<V>.() -> Unit): Assertion
|
||||
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
fun <K> nullableFirst(plant: AssertionPlant<Pair<K, *>>, assertionCreator: AssertionPlantNullable<K>.() -> Unit): Assertion
|
||||
fun <K> nullableFirst(
|
||||
plant: AssertionPlant<Pair<K, *>>,
|
||||
assertionCreator: AssertionPlantNullable<K>.() -> Unit
|
||||
): Assertion
|
||||
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
fun <V> nullableSecond(plant: AssertionPlant<Pair<*, V>>, assertionCreator: AssertionPlantNullable<V>.() -> Unit): Assertion
|
||||
fun <V> nullableSecond(
|
||||
plant: AssertionPlant<Pair<*, V>>,
|
||||
assertionCreator: AssertionPlantNullable<V>.() -> Unit
|
||||
): Assertion
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ interface ThrowableAssertions {
|
||||
/**
|
||||
* Turns the given [assertionVerb] into an [Untranslatable] and delegates to the other overload.
|
||||
*/
|
||||
fun thrownBuilder(assertionVerb: String, act: () -> Unit, reporter: Reporter): ThrowableThrown.Builder
|
||||
= thrownBuilder(Untranslatable(assertionVerb), act, reporter)
|
||||
fun thrownBuilder(assertionVerb: String, act: () -> Unit, reporter: Reporter): ThrowableThrown.Builder =
|
||||
thrownBuilder(Untranslatable(assertionVerb), act, reporter)
|
||||
|
||||
fun thrownBuilder(assertionVerb: Translatable, act: () -> Unit, reporter: Reporter): ThrowableThrown.Builder
|
||||
}
|
||||
|
||||
@@ -27,10 +27,12 @@ val anyTypeTransformationAssertions by lazy { loadSingleService(AnyTypeTransform
|
||||
interface AnyTypeTransformationAssertions {
|
||||
|
||||
|
||||
@Deprecated("This function will be removed in v.1.0.0 in favour of AssertImpl.any.isNotNull", ReplaceWith(
|
||||
@Deprecated(
|
||||
"This function will be removed in v.1.0.0 in favour of AssertImpl.any.isNotNull", ReplaceWith(
|
||||
"plant.addAssertion(AssertImpl.any.isNotNull(plant, type, assertionCreator))",
|
||||
"ch.tutteli.atrium.domain.builders.AssertImpl"
|
||||
))
|
||||
)
|
||||
)
|
||||
fun <T : Any> isNotNull(
|
||||
plant: AssertionPlantNullable<T?>,
|
||||
type: KClass<T>,
|
||||
|
||||
@@ -41,14 +41,14 @@ interface FeatureExtractor {
|
||||
* Uses [coreFactory].[newMethodCallFormatter][CoreFactory.newMethodCallFormatter] to create a description
|
||||
* of a method call with the given [methodName] and the given [arguments].
|
||||
*/
|
||||
fun methodCall(methodName: String, vararg arguments: Any?): ParameterObjectOption
|
||||
= feature(coreFactory.newMethodCallFormatter().format(methodName, arguments))
|
||||
fun methodCall(methodName: String, vararg arguments: Any?): ParameterObjectOption =
|
||||
feature(coreFactory.newMethodCallFormatter().format(methodName, arguments))
|
||||
|
||||
/**
|
||||
* Uses the given [featureRepresentation] as description.
|
||||
*/
|
||||
fun feature(featureRepresentation: () -> String): ParameterObjectOption
|
||||
= withDescription(Untranslatable(featureRepresentation))
|
||||
fun feature(featureRepresentation: () -> String): ParameterObjectOption =
|
||||
withDescription(Untranslatable(featureRepresentation))
|
||||
|
||||
/**
|
||||
* Uses the given [translatable] as description of the feature.
|
||||
@@ -72,8 +72,7 @@ interface FeatureExtractor {
|
||||
*/
|
||||
fun <TSubject : Any, T : Any> withParameterObject(
|
||||
parameterObject: ParameterObject<TSubject, T>
|
||||
): Creator<TSubject, T>
|
||||
= featureExtractorCreatorFactory.create(featureDescription, parameterObject)
|
||||
): Creator<TSubject, T> = featureExtractorCreatorFactory.create(featureDescription, parameterObject)
|
||||
|
||||
/**
|
||||
* Uses the given [parameterObject] where a nullable feature is extracted by
|
||||
@@ -81,8 +80,8 @@ interface FeatureExtractor {
|
||||
*/
|
||||
fun <TSubject : Any, T : Any?> withParameterObjectNullable(
|
||||
parameterObject: ParameterObject<TSubject, T>
|
||||
): CreatorNullable<TSubject, T>
|
||||
= featureExtractorCreatorFactory.createNullable(featureDescription, parameterObject)
|
||||
): CreatorNullable<TSubject, T> =
|
||||
featureExtractorCreatorFactory.createNullable(featureDescription, parameterObject)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,8 @@ import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
|
||||
@Deprecated("will be removed with 1.0.0")
|
||||
internal class DescriptionOptionImpl : FeatureExtractor.DescriptionOption {
|
||||
override fun withDescription(translatable: Translatable): FeatureExtractor.ParameterObjectOption
|
||||
= ParameterObjectOptionImpl(translatable)
|
||||
override fun withDescription(translatable: Translatable): FeatureExtractor.ParameterObjectOption =
|
||||
ParameterObjectOptionImpl(translatable)
|
||||
}
|
||||
|
||||
@Deprecated("will be removed with 1.0.0")
|
||||
|
||||
@@ -2,10 +2,8 @@ package ch.tutteli.atrium.domain.creating.iterable.contains
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
import ch.tutteli.atrium.creating.AssertionHolder
|
||||
import ch.tutteli.atrium.creating.AssertionPlant
|
||||
import ch.tutteli.atrium.domain.creating.basic.contains.Contains
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.*
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.creators.IterableContainsAssertions
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
@@ -51,7 +49,8 @@ interface IterableContains {
|
||||
interface Creator<in T : Iterable<*>, in SC> : Contains.Creator<T, SC>
|
||||
|
||||
/**
|
||||
* Represents a check for the search result such as: the object is contained exactly once in the input of the search.
|
||||
* Represents a check for the search result such as:
|
||||
* the object is contained exactly once in the input of the search.
|
||||
*
|
||||
* It provides the method [createAssertion] which creates an [Assertion] representing this check.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents a filler step to emphasise that the next step defines the order within a group of a
|
||||
* [InOrderOnlyGroupedSearchBehaviour].
|
||||
|
||||
@@ -4,7 +4,6 @@ import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
import ch.tutteli.atrium.assertions.DescriptiveAssertion
|
||||
import ch.tutteli.atrium.creating.AssertionPlant
|
||||
import ch.tutteli.atrium.domain.creating.any.typetransformation.*
|
||||
import ch.tutteli.atrium.domain.creating.throwable.thrown.ThrowableThrown.*
|
||||
import ch.tutteli.atrium.domain.creating.throwable.thrown.creators.ThrowableThrownAssertions
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
@@ -17,7 +16,8 @@ import kotlin.reflect.KClass
|
||||
* as well as the minimum set of assertions an implementation of the domain of Atrium has to provide.
|
||||
*
|
||||
* The building process is typically started by the creation of a [Builder],
|
||||
* would allow to define an [AbsentThrowableMessageProvider] as well as an [AnyTypeTransformation.FailureHandler]
|
||||
* would allow to define an [AbsentThrowableMessageProvider] as well as an
|
||||
* [ch.tutteli.atrium.domain.creating.any.typetransformation.AnyTypeTransformation.FailureHandler]
|
||||
* (currently all [ThrowableThrownAssertions] specify it implicitly) and
|
||||
* is finalized by one of the [ThrowableThrownAssertions] which usually use a [Creator].
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ interface ThrowableThrown {
|
||||
* @param throwableThrownBuilder The [ThrowableThrown.Builder] containing inter alia the
|
||||
* [act][ThrowableThrown.Builder.act] lambda.
|
||||
*/
|
||||
fun executeActAssertNothingThrown(throwableThrownBuilder: ThrowableThrown.Builder)
|
||||
fun executeActAssertNothingThrown(throwableThrownBuilder: Builder)
|
||||
|
||||
/**
|
||||
* Executes the [act][ThrowableThrown.Builder.act] lambda of the given [throwableThrownBuilder], catches any
|
||||
@@ -74,7 +74,7 @@ interface ThrowableThrown {
|
||||
* case it was thrown as expected and is of the expected type [TExpected].
|
||||
*/
|
||||
fun executeActAndCreateAssertion(
|
||||
throwableThrownBuilder: ThrowableThrown.Builder,
|
||||
throwableThrownBuilder: Builder,
|
||||
description: Translatable,
|
||||
expectedType: KClass<TExpected>,
|
||||
assertionCreator: AssertionPlant<TExpected>.() -> Unit
|
||||
|
||||
@@ -20,6 +20,11 @@ val bigDecimalAssertions by lazy { loadSingleService(BigDecimalAssertions::class
|
||||
interface BigDecimalAssertions {
|
||||
fun <T : BigDecimal> isNumericallyEqualTo(subjectProvider: SubjectProvider<T>, expected: T): Assertion
|
||||
fun <T : BigDecimal> isNotNumericallyEqualTo(subjectProvider: SubjectProvider<T>, expected: T): Assertion
|
||||
fun <T : BigDecimal> isEqualIncludingScale(subjectProvider: SubjectProvider<T>, expected: T, nameOfIsNumericallyEqualTo: String): Assertion
|
||||
fun <T : BigDecimal> isEqualIncludingScale(
|
||||
subjectProvider: SubjectProvider<T>,
|
||||
expected: T,
|
||||
nameOfIsNumericallyEqualTo: String
|
||||
): Assertion
|
||||
|
||||
fun <T : BigDecimal> isNotEqualIncludingScale(subjectProvider: SubjectProvider<T>, expected: T): Assertion
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ch.tutteli.atrium.domain.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.creating.AssertionPlant
|
||||
import ch.tutteli.atrium.creating.SubjectProvider
|
||||
import java.math.BigDecimal
|
||||
|
||||
@@ -10,5 +9,9 @@ import java.math.BigDecimal
|
||||
* [BigDecimal]), which an implementation of the domain of Atrium has to provide.
|
||||
*/
|
||||
actual interface FloatingPointAssertions : FloatingPointAssertionsCommon {
|
||||
fun <T : BigDecimal> toBeWithErrorTolerance(subjectProvider: SubjectProvider<T>, expected: T, tolerance: T): Assertion
|
||||
fun <T : BigDecimal> toBeWithErrorTolerance(
|
||||
subjectProvider: SubjectProvider<T>,
|
||||
expected: T,
|
||||
tolerance: T
|
||||
): Assertion
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.domain.builders
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -38,7 +38,6 @@ object MapEntryAssertionsBuilder : MapEntryAssertions {
|
||||
mapEntryAssertions.value(assertionContainer)
|
||||
|
||||
|
||||
|
||||
@Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
override inline fun <K : Any, V : Any> isKeyValue(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE")
|
||||
|
||||
package ch.tutteli.atrium.domain.builders.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
|
||||
@@ -103,10 +103,12 @@ object AnyAssertionsBuilder : AnyAssertions {
|
||||
object AnyTypeTransformationAssertionsBuilder : AnyTypeTransformationAssertions {
|
||||
|
||||
@Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@Deprecated("This function will be removed in v.1.0.0 in favour of AssertImpl.any.isNotNull", ReplaceWith(
|
||||
@Deprecated(
|
||||
"This function will be removed in v.1.0.0 in favour of AssertImpl.any.isNotNull", ReplaceWith(
|
||||
"plant.addAssertion(AssertImpl.any.isNotNull(plant, type, assertionCreator))",
|
||||
"ch.tutteli.atrium.domain.builders.AssertImpl"
|
||||
))
|
||||
)
|
||||
)
|
||||
override inline fun <T : Any> isNotNull(
|
||||
plant: AssertionPlantNullable<T?>,
|
||||
type: KClass<T>,
|
||||
|
||||
@@ -273,7 +273,9 @@ interface FeatureExtractorBuilder {
|
||||
canBeTransformed: (T) -> Boolean,
|
||||
transformation: (T) -> R,
|
||||
representationInsteadOfFeature: Any?
|
||||
): FinalStep<T, R> = FinalStepImpl(checkOption, canBeTransformed, transformation, representationInsteadOfFeature)
|
||||
): FinalStep<T, R> = FinalStepImpl(
|
||||
checkOption, canBeTransformed, transformation, representationInsteadOfFeature
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@file:Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE")
|
||||
|
||||
package ch.tutteli.atrium.domain.builders.creating
|
||||
|
||||
import ch.tutteli.atrium.core.polyfills.loadSingleService
|
||||
@@ -21,32 +22,32 @@ import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
*/
|
||||
object CharSequenceAssertionsBuilder : CharSequenceAssertions {
|
||||
|
||||
override inline fun <T : CharSequence> containsBuilder(subjectProvider: SubjectProvider<T>)
|
||||
= charSequenceAssertions.containsBuilder(subjectProvider)
|
||||
override inline fun <T : CharSequence> containsBuilder(subjectProvider: SubjectProvider<T>) =
|
||||
charSequenceAssertions.containsBuilder(subjectProvider)
|
||||
|
||||
override inline fun <T : CharSequence> containsNotBuilder(subjectProvider: SubjectProvider<T>)
|
||||
= charSequenceAssertions.containsNotBuilder(subjectProvider)
|
||||
override inline fun <T : CharSequence> containsNotBuilder(subjectProvider: SubjectProvider<T>) =
|
||||
charSequenceAssertions.containsNotBuilder(subjectProvider)
|
||||
|
||||
override inline fun startsWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence)
|
||||
= charSequenceAssertions.startsWith(subjectProvider, expected)
|
||||
override inline fun startsWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence) =
|
||||
charSequenceAssertions.startsWith(subjectProvider, expected)
|
||||
|
||||
override inline fun startsNotWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence)
|
||||
= charSequenceAssertions.startsNotWith(subjectProvider, expected)
|
||||
override inline fun startsNotWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence) =
|
||||
charSequenceAssertions.startsNotWith(subjectProvider, expected)
|
||||
|
||||
override inline fun endsWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence)
|
||||
= charSequenceAssertions.endsWith(subjectProvider, expected)
|
||||
override inline fun endsWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence) =
|
||||
charSequenceAssertions.endsWith(subjectProvider, expected)
|
||||
|
||||
override inline fun endsNotWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence)
|
||||
= charSequenceAssertions.endsNotWith(subjectProvider, expected)
|
||||
override inline fun endsNotWith(subjectProvider: SubjectProvider<CharSequence>, expected: CharSequence) =
|
||||
charSequenceAssertions.endsNotWith(subjectProvider, expected)
|
||||
|
||||
override inline fun isEmpty(subjectProvider: SubjectProvider<CharSequence>)
|
||||
= charSequenceAssertions.isEmpty(subjectProvider)
|
||||
override inline fun isEmpty(subjectProvider: SubjectProvider<CharSequence>) =
|
||||
charSequenceAssertions.isEmpty(subjectProvider)
|
||||
|
||||
override inline fun isNotEmpty(subjectProvider: SubjectProvider<CharSequence>)
|
||||
= charSequenceAssertions.isNotEmpty(subjectProvider)
|
||||
override inline fun isNotEmpty(subjectProvider: SubjectProvider<CharSequence>) =
|
||||
charSequenceAssertions.isNotEmpty(subjectProvider)
|
||||
|
||||
override inline fun isNotBlank(subjectProvider: SubjectProvider<CharSequence>)
|
||||
= charSequenceAssertions.isNotBlank(subjectProvider)
|
||||
override inline fun isNotBlank(subjectProvider: SubjectProvider<CharSequence>) =
|
||||
charSequenceAssertions.isNotBlank(subjectProvider)
|
||||
|
||||
/**
|
||||
* Returns [CharSequenceContainsAssertionsBuilder]
|
||||
@@ -62,23 +63,35 @@ object CharSequenceAssertionsBuilder : CharSequenceAssertions {
|
||||
*/
|
||||
object CharSequenceContainsAssertionsBuilder : CharSequenceContainsAssertions {
|
||||
|
||||
override inline fun <T : CharSequence> values(checkerOption: CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>, expected: List<Any>)
|
||||
= charSequenceContainsAssertions.values(checkerOption, expected)
|
||||
override inline fun <T : CharSequence> values(
|
||||
checkerOption: CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>,
|
||||
expected: List<Any>
|
||||
) = charSequenceContainsAssertions.values(checkerOption, expected)
|
||||
|
||||
override inline fun <T : CharSequence> valuesIgnoringCase(checkerOption: CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>, expected: List<Any>)
|
||||
= charSequenceContainsAssertions.valuesIgnoringCase(checkerOption, expected)
|
||||
override inline fun <T : CharSequence> valuesIgnoringCase(
|
||||
checkerOption: CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>,
|
||||
expected: List<Any>
|
||||
) = charSequenceContainsAssertions.valuesIgnoringCase(checkerOption, expected)
|
||||
|
||||
override inline fun <T : CharSequence> defaultTranslationOf(checkerOption: CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>, expected: List<Translatable>)
|
||||
= charSequenceContainsAssertions.defaultTranslationOf(checkerOption, expected)
|
||||
override inline fun <T : CharSequence> defaultTranslationOf(
|
||||
checkerOption: CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>,
|
||||
expected: List<Translatable>
|
||||
) = charSequenceContainsAssertions.defaultTranslationOf(checkerOption, expected)
|
||||
|
||||
override inline fun <T : CharSequence> defaultTranslationOfIgnoringCase(checkerOption: CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>, expected: List<Translatable>)
|
||||
= charSequenceContainsAssertions.defaultTranslationOfIgnoringCase(checkerOption, expected)
|
||||
override inline fun <T : CharSequence> defaultTranslationOfIgnoringCase(
|
||||
checkerOption: CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>,
|
||||
expected: List<Translatable>
|
||||
) = charSequenceContainsAssertions.defaultTranslationOfIgnoringCase(checkerOption, expected)
|
||||
|
||||
override inline fun <T : CharSequence> regex(checkerOption: CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>, expected: List<String>)
|
||||
= charSequenceContainsAssertions.regex(checkerOption, expected)
|
||||
override inline fun <T : CharSequence> regex(
|
||||
checkerOption: CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>,
|
||||
expected: List<String>
|
||||
) = charSequenceContainsAssertions.regex(checkerOption, expected)
|
||||
|
||||
override inline fun <T : CharSequence> regexIgnoringCase(checkerOption: CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>, expected: List<String>)
|
||||
= charSequenceContainsAssertions.regexIgnoringCase(checkerOption, expected)
|
||||
override inline fun <T : CharSequence> regexIgnoringCase(
|
||||
checkerOption: CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>,
|
||||
expected: List<String>
|
||||
) = charSequenceContainsAssertions.regexIgnoringCase(checkerOption, expected)
|
||||
|
||||
/**
|
||||
* Returns [CharSequenceContainsSearchBehaviourFactoryBuilder]
|
||||
@@ -94,6 +107,8 @@ object CharSequenceContainsAssertionsBuilder: CharSequenceContainsAssertions {
|
||||
*/
|
||||
object CharSequenceContainsSearchBehaviourFactoryBuilder : SearchBehaviourFactory {
|
||||
|
||||
override inline fun <T : CharSequence> ignoringCase(containsBuilder: CharSequenceContains.Builder<T, NoOpSearchBehaviour>): CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour>
|
||||
= searchBehaviourFactory.ignoringCase(containsBuilder)
|
||||
override inline fun <T : CharSequence> ignoringCase(
|
||||
containsBuilder: CharSequenceContains.Builder<T, NoOpSearchBehaviour>
|
||||
): CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour> =
|
||||
searchBehaviourFactory.ignoringCase(containsBuilder)
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ object ThrowableThrownAssertionsBuilder : ThrowableThrownAssertions {
|
||||
|
||||
@Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
override inline fun nothingThrown(throwableThrownBuilder: ThrowableThrown.Builder)
|
||||
= throwableThrownAssertions.nothingThrown(throwableThrownBuilder)
|
||||
override inline fun nothingThrown(throwableThrownBuilder: ThrowableThrown.Builder) =
|
||||
throwableThrownAssertions.nothingThrown(throwableThrownBuilder)
|
||||
|
||||
/**
|
||||
* Returns [AbsentThrowableMessageProviderFactoryBuilder]
|
||||
@@ -71,7 +71,8 @@ object ThrowableThrownAssertionsBuilder : ThrowableThrownAssertions {
|
||||
*/
|
||||
@Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION")
|
||||
@Deprecated("Will be removed with 1.0.0")
|
||||
inline val providers get() = AbsentThrowableMessageProviderFactoryBuilder
|
||||
inline val providers
|
||||
get() = AbsentThrowableMessageProviderFactoryBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +82,8 @@ object ThrowableThrownAssertionsBuilder : ThrowableThrownAssertions {
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Will be removed with 1.0.0")
|
||||
object AbsentThrowableMessageProviderFactoryBuilder : ch.tutteli.atrium.domain.creating.throwable.thrown.providers.AbsentThrowableMessageProviderFactory {
|
||||
object AbsentThrowableMessageProviderFactoryBuilder :
|
||||
ch.tutteli.atrium.domain.creating.throwable.thrown.providers.AbsentThrowableMessageProviderFactory {
|
||||
|
||||
override inline fun translatableBased(translatable: Translatable): ThrowableThrown.AbsentThrowableMessageProvider =
|
||||
absentThrowableMessageProviderFactory.translatableBased(translatable)
|
||||
|
||||
@@ -32,7 +32,7 @@ interface AssertionFormatterControllerOption {
|
||||
fun withAssertionFormatterController(assertionFormatterController: AssertionFormatterController): AssertionFormatterFacadeOption
|
||||
|
||||
companion object {
|
||||
fun create(objectFormatter: ObjectFormatter, translator: Translator): AssertionFormatterControllerOption
|
||||
= AssertionFormatterControllerOptionImpl(objectFormatter, translator)
|
||||
fun create(objectFormatter: ObjectFormatter, translator: Translator): AssertionFormatterControllerOption =
|
||||
AssertionFormatterControllerOptionImpl(objectFormatter, translator)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ interface AssertionFormatterFacadeOption {
|
||||
assertionFormatterController: AssertionFormatterController,
|
||||
objectFormatter: ObjectFormatter,
|
||||
translator: Translator
|
||||
): AssertionFormatterFacadeOption
|
||||
= AssertionFormatterFacadeOptionImpl(assertionFormatterController, objectFormatter, translator)
|
||||
): AssertionFormatterFacadeOption =
|
||||
AssertionFormatterFacadeOptionImpl(assertionFormatterController, objectFormatter, translator)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,14 @@ interface AssertionPairFormatterOption {
|
||||
/**
|
||||
* Uses [CoreFactory.newTextSameLineAssertionPairFormatter] as [AssertionPairFormatter].
|
||||
*/
|
||||
fun withTextSameLineAssertionPairFormatter(): TextAssertionFormatterOption
|
||||
= withTextAssertionPairFormatter(coreFactory::newTextSameLineAssertionPairFormatter)
|
||||
fun withTextSameLineAssertionPairFormatter(): TextAssertionFormatterOption =
|
||||
withTextAssertionPairFormatter(coreFactory::newTextSameLineAssertionPairFormatter)
|
||||
|
||||
/**
|
||||
* Uses [CoreFactory.newTextNextLineAssertionPairFormatter] as [AssertionPairFormatter].
|
||||
*/
|
||||
fun withTextNextLineAssertionPairFormatter(): TextAssertionFormatterOption
|
||||
= withTextAssertionPairFormatter(coreFactory::newTextNextLineAssertionPairFormatter)
|
||||
fun withTextNextLineAssertionPairFormatter(): TextAssertionFormatterOption =
|
||||
withTextAssertionPairFormatter(coreFactory::newTextNextLineAssertionPairFormatter)
|
||||
|
||||
/**
|
||||
* Uses the given [factory] to build a custom [AssertionPairFormatter].
|
||||
@@ -41,13 +41,12 @@ interface AssertionPairFormatterOption {
|
||||
assertionFormatterFacade: AssertionFormatterFacade,
|
||||
objectFormatter: ObjectFormatter,
|
||||
translator: Translator
|
||||
): AssertionPairFormatterOption
|
||||
= create(AssertionFormatterChosenOptions(
|
||||
assertionFormatterFacade, objectFormatter, translator
|
||||
))
|
||||
): AssertionPairFormatterOption = create(
|
||||
AssertionFormatterChosenOptions(assertionFormatterFacade, objectFormatter, translator)
|
||||
)
|
||||
|
||||
fun create(options: AssertionFormatterChosenOptions): AssertionPairFormatterOption
|
||||
= AssertionPairFormatterOptionImpl(options)
|
||||
fun create(options: AssertionFormatterChosenOptions): AssertionPairFormatterOption =
|
||||
AssertionPairFormatterOptionImpl(options)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ interface LocaleOrderDeciderOption {
|
||||
fun withLocaleOrderDecider(localeOrderDecider: LocaleOrderDecider): TranslatorOption
|
||||
|
||||
companion object {
|
||||
fun create(translationSupplier: TranslationSupplier): LocaleOrderDeciderOption
|
||||
= LocaleOrderDeciderOptionImpl(translationSupplier)
|
||||
fun create(translationSupplier: TranslationSupplier): LocaleOrderDeciderOption =
|
||||
LocaleOrderDeciderOptionImpl(translationSupplier)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ interface ObjectFormatterOption {
|
||||
fun withObjectFormatter(factory: (Translator) -> ObjectFormatter): AssertionFormatterControllerOption
|
||||
|
||||
companion object {
|
||||
fun create(translator: Translator): ObjectFormatterOption
|
||||
= ObjectFormatterOptionImpl(translator)
|
||||
fun create(translator: Translator): ObjectFormatterOption = ObjectFormatterOptionImpl(translator)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ import ch.tutteli.atrium.reporting.translating.*
|
||||
* Entry point to build a [Reporter]
|
||||
* -- the first step provides options to create a [Translator] or a [TranslationSupplier].
|
||||
*/
|
||||
@Deprecated("use ExpectIml.reporterBuilder instead; will be removed with 1.0.0", ReplaceWith("ExpectImpl.reporterBuilder", "ch.tutteli.atrium.domain.builders.ExpectImpl"))
|
||||
@Deprecated(
|
||||
"use ExpectIml.reporterBuilder instead; will be removed with 1.0.0",
|
||||
ReplaceWith("ExpectImpl.reporterBuilder", "ch.tutteli.atrium.domain.builders.ExpectImpl")
|
||||
)
|
||||
val reporterBuilder: ReporterBuilder = ReporterBuilderImpl
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ interface ReporterBuilderFinalStep {
|
||||
fun build(): Reporter
|
||||
|
||||
companion object {
|
||||
fun create(factory: () -> Reporter): ReporterBuilderFinalStep
|
||||
= ReporterBuilderFinalStepImpl(factory)
|
||||
fun create(factory: () -> Reporter): ReporterBuilderFinalStep = ReporterBuilderFinalStepImpl(factory)
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user