pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

UnsupportedOperationException when having more than 1 interaction #1088

Open iPlessmann opened 4 years ago

iPlessmann commented 4 years ago

Hi all, Im following ExamplePactSpec to migrate from ScalaPact to PactJVM. Im having an issue when having 2 interactions like in the example, i get the following exception:

[error]  java.lang.UnsupportedOperationException: null (MutableCollectionsJVM.kt:42)
[error] kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(MutableCollectionsJVM.kt:42)
[error] au.com.dius.pact.core.model.RequestResponsePact.sortInteractions(RequestResponsePact.kt:65)
[error] au.com.dius.pact.core.model.DefaultPactWriter.writePact(PactWriter.kt:56)
[error] au.com.dius.pact.core.model.DefaultPactWriter.writePact(PactWriter.kt:100)
[error] au.com.dius.pact.consumer.BaseMockServer.verifyResultAndWritePact(MockHttpServer.kt:133)
[error] au.com.dius.pact.consumer.BaseMockServer.runAndWritePact(MockHttpServer.kt:119)
[error] au.com.dius.pact.consumer.ConsumerPactRunnerKt.runConsumerTest(ConsumerPactRunner.kt:13)
[error] au.com.dius.pact.consumer.specs2.PactSpec$ReadyForTest.$anonfun$withConsumerTest$2(PactSpec.scala:54)
[error] au.com.dius.pact.consumer.specs2.PactSpec$$anon$1.asResult(PactSpec.scala:33)

I copied the example from the repo previously referenced and got the same error. So far i can infer an issue while sorting interactions but i have no clue what i am missing, can anyone point me in the correct path? Im using Java 11 but it also fails in Java 8.

uglyog commented 4 years ago

Are you able to provide your test?