diff --git a/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt b/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt index 1ac44d2..76bc090 100644 --- a/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt +++ b/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt @@ -62,8 +62,8 @@ infix fun Result<*, E>.shouldBeFailure(expected: E) = private fun Result.matchesValue(actual: Result): MatcherResult = matcherResultWithIntelliJDiff( passed = this == actual, - actual = this.toString(), - expected = actual.toString() + actual = actual.toString(), + expected = this.toString() ) private fun > Result.matchesType(expected: KClass): MatcherResult = diff --git a/result4k/kotest/src/test/kotlin/dev/forkhandles/result4k/kotest/MatchersTest.kt b/result4k/kotest/src/test/kotlin/dev/forkhandles/result4k/kotest/MatchersTest.kt index 4d7070e..4a5bc56 100644 --- a/result4k/kotest/src/test/kotlin/dev/forkhandles/result4k/kotest/MatchersTest.kt +++ b/result4k/kotest/src/test/kotlin/dev/forkhandles/result4k/kotest/MatchersTest.kt @@ -22,7 +22,7 @@ class MatchersTest { assertDoesNotThrow { success.shouldBeSuccess() } assertDoesNotThrow { success.shouldBeSuccess() shouldBe value } assertDoesNotThrow { success.shouldBeSuccess { assertEquals(value, it) } } - assertDoesNotThrow { success.shouldBeSuccess(value) } + assertDoesNotThrow { success shouldBeSuccess value } } @Test @@ -33,7 +33,7 @@ class MatchersTest { assertDoesNotThrow { failure.shouldBeFailure() } assertDoesNotThrow { failure.shouldBeFailure() shouldBe reason } assertDoesNotThrow { failure.shouldBeFailure { assertEquals(reason, it) } } - assertDoesNotThrow { failure.shouldBeFailure(reason) } + assertDoesNotThrow { failure shouldBeFailure reason } } @Test @@ -47,8 +47,8 @@ class MatchersTest { throwsAssertionError("expected: but was:") { success.shouldBeFailure { } } - throwsAssertionError("expected: but was:") { - success.shouldBeFailure(value) + throwsAssertionError("expected: but was:") { + success shouldBeFailure value } } @@ -63,25 +63,25 @@ class MatchersTest { throwsAssertionError("expected: but was:") { failure.shouldBeSuccess { } } - throwsAssertionError("expected: but was:") { - failure.shouldBeSuccess(reason) + throwsAssertionError("expected: but was:") { + failure shouldBeSuccess reason } } @Test fun `should correctly assert value`() { - throwsAssertionError("expected: but was:") { - Failure("Actual value").shouldBeFailure("Expected value") + throwsAssertionError("expected: but was:") { + Failure("Actual value") shouldBeFailure "Expected value" } - throwsAssertionError("expected: but was:") { - Success("Actual value").shouldBeSuccess("Expected value") + throwsAssertionError("expected: but was:") { + Success("Actual value") shouldBeSuccess "Expected value" } } @Test @Disabled // Comment out to check it manually fun `check IntelliJ is showing diff window`() { - Success("Actual value").shouldBeSuccess("Expected value") + Success("Actual value") shouldBeSuccess "Expected value" } private fun throwsAssertionError(message: String, block: () -> Unit) =