From dce7446ac368a5c357452f26e877320d71d98e51 Mon Sep 17 00:00:00 2001 From: Matthias Geisler Date: Tue, 26 Apr 2022 10:12:27 +0200 Subject: [PATCH] Update doc on new VerificationChain --- CHANGELOG.adoc | 4 ++-- .../antibytes/kmock/example/contract/PlatformDecoderSpec.kt | 2 +- .../kotlin/tech/antibytes/kmock/verification/Asserter.kt | 3 ++- .../antibytes/kmock/verification/NonFreezingAsserter.kt | 3 ++- .../tech/antibytes/kmock/verification/Verification.kt | 4 ++-- .../tech/antibytes/kmock/verification/VerificationChain.kt | 6 +++--- .../kmock/verification/StrictVerificationChainSpec.kt | 1 - .../antibytes/kmock/verification/VerificationChainSpec.kt | 2 -- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1b6a8afa..806afb6b 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -39,7 +39,7 @@ toc::[] * `allowInterfaces`, which combines `allowInterfacesOnKmock` and `allowInterfacesOnKspy` * `disableFactories` in order to disable the generation of `kmock` and `kspy` if needed * `customAnnotationsForMeta` to provide a hook for the usage of customized annotation for meta/shared sources -* `assertOrder` in order to make the names more consistent and which should be used to validate a total linear order of Proxies +* `assertOrder` in order to make the names more consistent and preserves the old behaviour of `verifyStrictOrder` === Changed @@ -49,11 +49,11 @@ toc::[] * Non intrusive behaviour (spy & relaxation) is now resolved by proxy invocation rather then by proxy initialisation in order to cover edge cases * Assertion-/VerificationChain is not coupled any longer directly to proxies and provide improved error messages * Expectation-methods do not bleed into the global context any longer +* `verifyStrictOrder` is now used for total order of certain Proxies but allows partial order between different Proxies === Deprecated * `uselessPrefixes` in the Gradle Extension -* `verifyStrictOrder` use `assertOrder` instead === Removed diff --git a/examples/src/iosTest/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoderSpec.kt b/examples/src/iosTest/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoderSpec.kt index 1d601f2b..7afc363b 100644 --- a/examples/src/iosTest/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoderSpec.kt +++ b/examples/src/iosTest/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoderSpec.kt @@ -13,6 +13,6 @@ import kotlin.test.Test class PlatformDecoderSpec { @Test fun doSomething() { - TODO() + // TODO } } diff --git a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Asserter.kt b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Asserter.kt index c9de3890..c75fd0b9 100644 --- a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Asserter.kt +++ b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Asserter.kt @@ -22,6 +22,7 @@ class Asserter(coverAllInvocations: Boolean = false) : AsserterBase(coverAllInvo } /** - * + * Alias to Asserter. + * @author Matthias Geisler */ typealias Verifier = Asserter diff --git a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/NonFreezingAsserter.kt b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/NonFreezingAsserter.kt index 0b90d53b..b48b6210 100644 --- a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/NonFreezingAsserter.kt +++ b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/NonFreezingAsserter.kt @@ -20,6 +20,7 @@ class NonFreezingAsserter(coverAllInvocations: Boolean = false) : AsserterBase(c } /** - * + * Alias to NonFreezingAsserter. + * @author Matthias Geisler */ typealias NonFreezingVerifier = NonFreezingAsserter diff --git a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Verification.kt b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Verification.kt index ca387050..345da5cf 100644 --- a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Verification.kt +++ b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Verification.kt @@ -91,10 +91,10 @@ fun runAssertion( fun Asserter.assertOrder(action: ChainedAssertion.() -> Any) = runAssertion(AssertionChain(references), action) /** - * Alias of assertOrder. + * Verifies a chain of Expectations. Expectation between different proxies can contain gaps. + * Also the chain does not need to be exhaustive. * @param action chain of Expectation Methods. * @throws AssertionError if given criteria are not met. - * @see assertOrder * @author Matthias Geisler */ fun Asserter.verifyStrictOrder(action: ChainedAssertion.() -> Any) { diff --git a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/VerificationChain.kt b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/VerificationChain.kt index d09ef977..3a0c798d 100644 --- a/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/VerificationChain.kt +++ b/kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/VerificationChain.kt @@ -9,18 +9,18 @@ package tech.antibytes.kmock.verification import kotlinx.atomicfu.atomic import kotlinx.atomicfu.update import tech.antibytes.kmock.KMockContract -import tech.antibytes.kmock.KMockContract.FunProxy -import tech.antibytes.kmock.KMockContract.PropertyProxy -import tech.antibytes.kmock.KMockContract.Proxy import tech.antibytes.kmock.KMockContract.AssertionChain import tech.antibytes.kmock.KMockContract.CALL_NOT_FOUND import tech.antibytes.kmock.KMockContract.CALL_WITH_ARGS_NOT_FOUND import tech.antibytes.kmock.KMockContract.ChainedAssertion +import tech.antibytes.kmock.KMockContract.FunProxy import tech.antibytes.kmock.KMockContract.ILLEGAL_VALUE import tech.antibytes.kmock.KMockContract.MISSING_INVOCATION import tech.antibytes.kmock.KMockContract.NOT_GET import tech.antibytes.kmock.KMockContract.NOT_PART_OF_CHAIN import tech.antibytes.kmock.KMockContract.NOT_SET +import tech.antibytes.kmock.KMockContract.PropertyProxy +import tech.antibytes.kmock.KMockContract.Proxy import tech.antibytes.kmock.KMockContract.VOID_FUNCTION import tech.antibytes.kmock.util.format diff --git a/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/StrictVerificationChainSpec.kt b/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/StrictVerificationChainSpec.kt index bbd4bded..b34fe752 100644 --- a/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/StrictVerificationChainSpec.kt +++ b/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/StrictVerificationChainSpec.kt @@ -9,7 +9,6 @@ package tech.antibytes.kmock.verification import tech.antibytes.kmock.KMockContract import tech.antibytes.kmock.KMockContract.Proxy import tech.antibytes.kmock.KMockContract.Reference -import tech.antibytes.kmock.fixture.fixtureVerificationHandle import tech.antibytes.kmock.fixture.funProxyFixture import tech.antibytes.kmock.fixture.propertyProxyFixture import tech.antibytes.mock.AssertionsStub diff --git a/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/VerificationChainSpec.kt b/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/VerificationChainSpec.kt index f219a1ac..8e609c9a 100644 --- a/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/VerificationChainSpec.kt +++ b/kmock/src/commonTest/kotlin/tech/antibytes/kmock/verification/VerificationChainSpec.kt @@ -11,10 +11,8 @@ import tech.antibytes.kmock.KMockContract.GetOrSet import tech.antibytes.kmock.KMockContract.Reference import tech.antibytes.kmock.fixture.funProxyFixture import tech.antibytes.kmock.fixture.propertyProxyFixture -import tech.antibytes.mock.AssertionsStub import tech.antibytes.util.test.fixture.fixture import tech.antibytes.util.test.fixture.kotlinFixture -import tech.antibytes.util.test.fixture.listFixture import tech.antibytes.util.test.fulfils import tech.antibytes.util.test.mustBe import kotlin.js.JsName