You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the Kotlin error when tried to verify the PACT DSL response
java.lang.NoSuchMethodError: 'java.lang.Object kotlin.collections.CollectionsKt.maxWithOrNull(java.lang.Iterable, java.util.Comparator)'
at au.com.dius.pact.core.matchers.MatchingContext.selectBestMatcher(Matching.kt:55)
at au.com.dius.pact.core.matchers.MatchingContext.selectBestMatcher$default(Matching.kt:46)
at au.com.dius.pact.core.matchers.JsonContentMatcher.compareLists(JsonContentMatcher.kt:106)
at au.com.dius.pact.core.matchers.JsonContentMatcher.compare(JsonContentMatcher.kt:82)
at au.com.dius.pact.core.matchers.JsonContentMatcher.compareMaps(JsonContentMatcher.kt:159)
at au.com.dius.pact.core.matchers.JsonContentMatcher.compare(JsonContentMatcher.kt:80)
at au.com.dius.pact.core.matchers.JsonContentMatcher.matchBody(JsonContentMatcher.kt:36)
at au.com.dius.pact.core.matchers.Matching.matchBody(Matching.kt:235)
at au.com.dius.pact.core.matchers.ResponseMatching.responseMismatches(ResponseMatching.kt:35)
at au.com.dius.pact.provider.ResponseComparison$Companion.compareResponse(ResponseComparison.kt:214)
at au.com.dius.pact.provider.ProviderVerifier.verifyRequestResponsePact(ProviderVerifier.kt:1032)
at au.com.dius.pact.provider.junit5.PactVerificationContext.validateTestExecution(PactVerificationContext.kt:110)
at au.com.dius.pact.provider.junit5.PactVerificationContext.verifyInteraction(PactVerificationContext.kt:61)
I already tried to install the kotlin version 1.8.20 in gradle but still not helpful:
id "org.jetbrains.kotlin.jvm" version "1.8.20"
Currently, I'm using the latest version for pact provider:
That method has been available in Kotlin since 1.4, so there must be something wrong with your project. Are you using Kotlin as well?
It's not the Kotlin plugin that is needed, but the Kotlin standard library. Try adding org.jetbrains.kotlin:kotlin-stdlib:1.7.22 or maybe try Pact-JVM 4.6.4 instead.
I found that the issue come from the lib de.adesso:junit-insights:1.1.0: It's using the old kotlin library. Although overriding the kotlin to org.jetbrains.kotlin:kotlin-stdlib:1.7.22 but it's still not work. We're using JAVA 11 so, we upgrade kotlin to 7.22 . There are 2 solutions:
Just remove junit-insights it's not used
excluded all kotlin dependencies from the lib junit-insights in your gradle
I got the Kotlin error when tried to verify the PACT DSL response
I already tried to install the kotlin version 1.8.20 in gradle but still not helpful:
Currently, I'm using the latest version for pact provider:
The text was updated successfully, but these errors were encountered: