https://pact.io logo
Join Slack
Powered by
# pact-jvm
  • g

    Gianluca Ciccarelli

    11/22/2024, 2:08 PM
    @Gianluca Ciccarelli has left the channel
  • t

    Tim Vahlbrock

    11/25/2024, 7:29 AM
    Hello everyone, I'm getting an OutOfMemoryError in Pact's Invocation of
    setupClassGraph
    in many provider tests and wasn't able to find out whats the problem. Some research shows that instead of a specific package, the class gaph scan is performed on the whole namespace. Does anyone no anything about this?
    • 1
    • 1
  • m

    Martin Konir

    11/28/2024, 1:55 PM
    Hey guys, I have kinda peculiar problem and I would appriciate any help or comment 🙏 ☕ In our microservice architecture, we have ONE consumer with MULTIPLE providers. The contract between the consumer and all providers is identical — all providers are required to adhere to the same contract with the consumer (this decision makes sense in the context of our organization). The consumer is a Java + JUnit5 project, and to prepare the Pact setup, we would typically define a separate
    @Pact
    method for each provider and write a corresponding
    @Test-s
    for each
    @Pact
    method. We are looking for a solution to avoid duplicating this code ( the
    @Pact
    and
    @Test
    methods) since the contract for each provider is the same. The desired outcome is to have a single
    @Pact
    definition and multiple
    @Test
    methods for this one definition. However, when the tests are executed and successful, multiple contracts (the same contract but with different provider names) should be generated and uploaded to the PactBroker. Is there a solution to achieve this, for example, by editing the mockserver in JUnit
    @AfterAll
    ? According to the Pact JVM library rules: • Each
    @Pact
    can have only one provider name. • Each
    @Pact
    must be associated with a test method
    m
    • 2
    • 2
  • r

    Ruth

    11/29/2024, 11:45 AM
    Hi, I am currently in the process of migrating multiple pacts to the Lambda DSL (I LOVE it 🫶). I am struggling to find the right substitute for
    arrayEachLike(examples: Int)
    . My example:
    Copy code
    @Pact(consumer = CONSUMER, provider = PROVIDER)
      RequestResponsePact pact(PactDslWithProvider builder) {
        return builder
            .uponReceiving("get cities")
            .method("GET")
            .path("/rest/cities")
            .willRespondWith()
            .status(200)
            .body(
                arrayEachLike(2)
                    .stringType("name", "Berlin")
            )
            .toPact()
      }
    I tried this, but I cannot give the number of examples I want to have here:
    Copy code
    .body(
      LambdaDsl.newJsonArray { rootArray: LambdaDslJsonArray ->
        rootArray.`object` { object ->
          object.stringType("name", "Berlin")
        }
      }.build()
    )
    What can I do instead to be able to put a number of examples in, but not a min/max size? When there is a field with type array I found the
    .eachLike
    method, but I cannot find anything for the root level.
    r
    • 2
    • 5
  • r

    Ruud Welling

    12/03/2024, 3:25 PM
    Hey, We are working on a change where a decision has been made to break an existing pact in a provider. Since this specific integration is not in use we would like to make a breaking change and update the consumers afterwards. Because of this we are looking for options to allowing our tests to run without failing the build. I know that WIP and Pending pacts actually allow provider tests to be green even though a failure was reported to the broker. So my question - is there an option in the pact Junit 5 extension to run the provider tests without making the build fail. That way we can still see what integrations we need to fix without blocking our pipelines Alternatively - is there a way to disable or skip certain specific provider tests?
    r
    e
    • 3
    • 10
  • g

    GitHub

    12/03/2024, 11:06 PM
    Release - 4.7.0-beta.0 New release published by rholshausen First beta release (Gradle 8.11, JDK 23, Kotlin 2) • 2d69044 - chore: Correct release script for Gradle 8.11 • 0ef92e0 - chore: Cleanup deprecation warnings • 3c780af - chore: Remove use of some deprecated items • e5efa22 - chore: Fix compiler and build warnings • aac59a6 - fix: With KTor mock server, block until the start coroutine is done • 5c7c78b - fix: With KTor mock server, need to wait for server to be responsive • b410304 - chore: Upgrade KTor to 3.0.1 • 78d3735 - chore: Cleanup compiler warnings • 0bb9790 - chore: Remove use of deprecated Response.generatedResponse method • cefdece - chore: Remove use of deprecated newHttpClient in PactReader • 3ee45e7 - chore: Upgrade Gradle to 8.11.1 • 603024c - chore: Upgrade Clojure to latest versions • b11433e - chore: Cleanup build warnings • 140915c - chore: Cleanup some deprecation warnings • f6b85fc - chore: Upgrade HTTP client to 5.4.1 • 8427c34 - chore: Remove uneeded com.michael-bull.kotlin-result:kotlin-result dependency • 99740fa - chore: Upgrade JUnit Jupiter to 5.11.3 • 642a3aa - chore: Detekt does not support JDK 22+ • 29bf10a - chore: Update readme • 84bd88f - chore: Upgrade Kotlin to 2.0.21 • 5a8dcc9 - chore(pact-jvm-server): Fixed CodeNarc violations • b8d6141 - chore(pact-jvm-server): Ignore MainSpec on CI • feba2e0 - chore(pact-jvm-server): Fixed failing test • 9fccb2b - chore(pact-jvm-server): Fixed CodeNarc violations • 393c22e - chore(pact-jvm-server): Run pact-jvm-server tests in CI • 73697db - chore(pact-jvm-server): Converted main Scala App to Kotlin • 9fe90db - chore(pact-jvm-server): Converted Scala Netty to Kotlin KTor server • 31287a1 - chore(pact-jvm-server): Converted RequestRouter to kotlin • ff7a287 - chore(pact-jvm-server): Converted Publish to kotlin • 5cf2e59 - chore(pact-jvm-server): Converted ListServers to kotlin • 22ba232 - chore(pact-jvm-server): Converted Complete to kotlin • de37b5e - chore(pact-jvm-server): Converted Create to kotlin • 36cf032 - chore(pact-jvm-server): Converted Result and ServerState to kotlin • 5c94820 - chore(pact-jvm-server): Converted MockProvider to kotlin • e95461a - Fix path to Clojure example (Christoph Burgmer) • 9f6b209 - chore: Add a test + update docs on JUnit 4 report dir default #1836 • 0234216 - chore(pact-jvm-server): Converted PactSession to Kotlin • d154527 - chore(pact-jvm-server): Converted PactSessionResults to Kotlin • 21c9978 - chore(pact-jvm-server): Add tests for ListServers handler • ca29ef0 - chore(pact-jvm-server): Move Config to Kotlin • 3e501f5 - chore: Add a test for pact-jvm-server • 7600b4a - chore: Update CI to run with JDK 23 • 1b80bc4 - chore: Update CI to run with JDK 21 • 33b6dde - chore: Update dependencies to support JDK 21 • 08a1fa4 - chore: Update CodeNarc to latest version • 4b374dc - chore: Upgrade Gradle to 8.10.2 • 8b8c28c - chore: Init new version branch pact-foundation/pact-jvm
  • g

    GitHub

    12/04/2024, 10:53 PM
    Release - 4.6.16 New release published by rholshausen Maintenance Release • 2d20163 - fix: Dependency conflict with org.slf4j:slf4j-api was causing Spring tests to fail • 38c0d27 - feat: Update LambdaDsl.newJsonArray to allow setting the number of examples • 19c663c - chore: The pact-jvm-server main spec was not configured correctly • 147a2a6 - fix: LambdaDslJsonArray has no datetime function #1839 • e95461a - Fix path to Clojure example (Christoph Burgmer) • 9f6b209 - chore: Add a test + update docs on JUnit 4 report dir default #1836 • 3e501f5 - chore: Add a test for pact-jvm-server pact-foundation/pact-jvm
  • e

    Eric Deandrea

    12/09/2024, 4:45 PM
    Hi folks! I just created a new PR (https://github.com/pact-foundation/pact-jvm/pull/1844) which adds support for more than just JUnit’s
    @Disabled
    annotation..
    Copy code
    org.junit.jupiter.api.condition.DisabledForJreRange
    org.junit.jupiter.api.condition.DisabledIf
    org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
    org.junit.jupiter.api.condition.DisabledIfEnvironmentVariables
    org.junit.jupiter.api.condition.DisabledIfSystemProperties
    org.junit.jupiter.api.condition.DisabledIfSystemProperty
    org.junit.jupiter.api.condition.DisabledInNativeImage
    org.junit.jupiter.api.condition.DisabledOnJre
    org.junit.jupiter.api.condition.DisabledOnOs
    r
    • 2
    • 6
  • r

    Ran Abitbul

    12/11/2024, 7:56 AM
    Hi team, Is there a util that converts a V4 pact with AsynchronousMessage interactions, into a V3 pact with Messages?
    m
    r
    • 3
    • 5
  • p

    Pietro Di Bello

    12/17/2024, 11:23 AM
    @Pietro Di Bello has left the channel
  • m

    miłosz Mazurek

    01/06/2025, 3:08 PM
    Hi, I've just started using pact with Spock - groovy. Unfortunately there is no such flexible annotations as @State like with Unit. So I prepared util methods which allow divide tests by interactions. And I have 3 questions related to my implementation: 1) Is it possible to prepare similar method to be able to divide tests by states (like in Unit) ? 2) I'm not sure if my implementation is optimal. Maybe is it possible do do something better (regarding interactions and Mvctest) ? Could you please help me with this questions ? Here is my code: Its spock test:
    Copy code
    @Provider('employee_spock_provider')
    @WebMvcTest
    class EmployeeControllerMvcSpec extends PactMvcTest {
    
        @Autowired
        MockMvc mockMvc
    
        @Shared
        ProviderInfo serviceProvider
        ProviderVerifier verifier
    
        @SpringBean
        EmployeeService employeeService = Mock()
    
        def setupSpec() {
            serviceProvider = new ProviderInfo("employee_spock_provider")
            serviceProvider.hasPactsFromPactBroker("<http://localhost:9292>")
        }
    
        def setup() {
            verifier = new ProviderVerifier()
            setupMockMvcTest(mockMvc, EmployeeControllerMvcSpec.class, this)
        }
    
    
        def 'verify contract for #consumer for interaction get all employees'() {
            given:
            employeeService.getEmployees() >> List.of(anEmployee(), anEmployee2())
    
            expect:
            verifyPactForInteraction(verifier, consumer, 'get all employees')
    
            where:
            consumer << serviceProvider.consumers
        }
    
    }
    b
    • 2
    • 2
  • m

    miłosz Mazurek

    01/06/2025, 3:09 PM
    And here are utils methods:
    Copy code
    class PactMvcTest extends Specification {
    
        @Shared
        private MockMvcTarget mockMvcTarget
    
        def setupSpec() {
            mockMvcTarget = new MockMvcTarget()
        }
    
        void setupMockMvcTest(MockMvc mockMvc, Class<?> clazz, Object testClass) {
            mockMvcTarget.setMockMvc(mockMvc)
            mockMvcTarget.setTestClass(new TestClass(clazz), testClass)
        }
    
    
        void verifyPactForInteraction(ProviderVerifier verifier, ConsumerInfo consumer, String description) {
            PactSource pactSource = consumer.getPactSource()
            List<Interaction> interactions = verifier.pactReader.loadPact(consumer.getPactSource()).getInteractions()
            Interaction interaction = Stream.ofNullable(interactions)
                    .flatMap(Collection::stream)
                    .filter(it -> it.getDescription().equals(description))
                    .findFirst()
                    .orElseGet (null)
    
            mockMvcTarget.testInteraction(consumer.getName(), interaction, pactSource, [:], false)
        }
    
    }
  • l

    ludorival

    01/11/2025, 11:40 AM
    Hi everyone, I just wanted to say how much I love the tools provided by the Pact Foundation—they’ve been a game-changer in our projects! I’ve recently proposed a library, pact-jvm-mock, that aims to enhance the pact-jvm ecosystem by simplifying the process of generating Pact contracts directly from existing mocks in Kotlin/Java applications. I believe this could make contract testing more seamless for many users. You can check out the proposal here: https://github.com/pact-foundation/pact-jvm/issues/1847. I’d be thrilled to hear your thoughts and feedback! Best regards, Ludovic
    j
    m
    • 3
    • 3
  • j

    Jonathan Chambers

    01/14/2025, 12:54 AM
    Hi all, I've been using Pact for a while now and have found it very useful - I'm so grateful for all the hard work you do! I'm now trying to use it to do request/response testing for something other that HTTP. Took a look at this test https://github.com/pact-foundation/pact-jvm/blob/master/consumer/junit5/src/test/groovy/au/com/dius/pact/consumer/junit5/V4SyncMessageTest.groovy which seemed to be the closest fit for what I want - and having trouble understanding... • In the HTTP case - the server is the provider (i.e. receives requests and sends replies), the client is the consumer (i.e. sends requests and receives replies), but in this test the comments seem to be the other way round - "_We test that our message consumer can handle the message request configured by the builder and returns a valid response message"_ - this feels like it should be the job of the provider/server? • In the HTTP case a mock server is passed into the Test which allows the test to generate a message and send the request to the mock server - but in this case the request is passed into the test method. I was expecting to be able to generate the request (by running code within the service) send it into PACT for validation, and then for PACT to send me a response back and for me to pass it back into the service for response processing testing. • For the consumer test I would be looking to run my code and for it to generate a request which I would pass into the PACT for validation. The PACT would then generate a response which the test would back into the service to ensure responses can be processed correctly. On the provider side it would then look very much like this test https://github.com/pact-foundation/pact-jvm/blob/master/provider/junit5/src/test/j[…]m/dius/pact/provider/junit5/SynchronousMessageContractTest.java (but connect to a broker to retrieve the pact) Any clarification/explanation/help would be appreciated.
    r
    m
    • 3
    • 5
  • r

    Ruth

    01/16/2025, 11:17 AM
    Hi, I am currently trying to move to V4 pacts. Currently I have this pact, which works
    Copy code
    @Pact(consumer = CONSUMER, provider = PROVIDER)
    RequestResponsePact provider(PactDslWithProvider builder) {
      return builder
          .uponReceiving("get")
          .method("GET")
          .headers("accept", "application/json, application/*+json")
          .path("/test")
          .willRespondWith()
          .status(200)
          .toPact()
    }
    I migrated it to look like this:
    Copy code
    @Pact(consumer = CONSUMER, provider = PROVIDER)
    V4Pact provider(PactBuilder builder) {
      return builder
          .expectsToReceiveHttpInteraction("get") { httpBuilder ->
            httpBuilder
                .withRequest { httpRequestBuilder ->
                  httpRequestBuilder
                      .path("/test")
                      .method("GET")
                      .headers("accept", "application/json, application/*+json")
                }
                .willRespondWith { httpResponseBuilder ->
                  httpResponseBuilder.status(200)
                }
          }
          .toPact()
    }
    but now I get this error message from Pact:
    Copy code
    2025-01-16 11:41:50,475 [HTTP-Dispatcher] ERROR  a.c.d.p.c.BaseMockServer$Companion - PartialRequestMatch: get:
        Expected header 'accept' to have value 'application/json' but was 'application/json, application/*+json'
        Expected header 'accept' to have value 'application/*+json' but was ''
    I am very confused as the signature of the method
    headers
    I am using shows it as a value:String. I also tried the
    .header
    method, but I still get the same error. Any idea what I can do?
    r
    • 2
    • 3
  • n

    Nuno Domingues

    01/22/2025, 9:47 AM
    Hello everyone, I have a quick question related to the generated PACTfile. Let's say that I have a bunch of tests that defines the contract (a bunch of interactions). If I run it various times the order of the interactions in the generated pact file can change. Let's say that I add one or more tests, where that interaction will be, in the top or the bottom of the generated file. Thanks
    m
    • 2
    • 5
  • t

    Tom Lopez

    01/22/2025, 4:04 PM
    @Tom Lopez has left the channel
  • r

    Romain Létendart

    01/31/2025, 4:56 PM
    @Romain Létendart has left the channel
  • t

    Tim Vahlbrock

    02/10/2025, 8:01 AM
    Hey there, I'm trying to integrate Pending and WIP Pacts. It seems like if I enable it, I also need to specify provider branch and/or provider tags, even if I don't want to publish the results. I don't get why this additional check is needed. As far as I can tell the branch or the tag is only used when publishing the test results, consequently without pending pacts the provider names are only needed when wanting to publish. I don't get why this shouldn't be the case for pending and WIP Pacts. Having to set this property means I either cannot run Pending and WIP Pacts locally (only in CI) or I need to retrieve the branch name at runtime.
    m
    • 2
    • 3
  • v

    Victor Vargas

    02/10/2025, 9:51 AM
    Hey folks, I have to work on an application that has just Spring and not Spring boot. Is there any handy way to verify the interactions, such as
    Copy code
    @TestTemplate
      @ExtendWith(PactVerificationInvocationContextProvider.class)
      public void pactVerificationTestTemplate(PactVerificationContext context) {
        context.verifyInteraction();
      }
    If not, what is the recommended way of doing so? Thanks in advance 🤗
  • v

    Victor Vargas

    02/10/2025, 2:53 PM
    Also FYI, if you are using DependencyConvergence plugin there are a bunch of errors of dependency missmatch between Pact packages, i.e.
    Copy code
    [WARNING] Rule 2: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message:
    Failed while enforcing releasability the error(s) are [
    Dependency convergence error for org.apache.tika:tika-core:2.9.1 paths to dependency are:
    +-com.myproject:1.55.8-SNAPSHOT
      +-au.com.dius.pact.provider:spring:4.6.16
        +-au.com.dius.pact.provider:junit:4.6.16
          +-au.com.dius.pact:provider:4.6.16
            +-au.com.dius.pact.core:matchers:4.6.16
              +-org.apache.tika:tika-core:2.9.1
    and
    +-com.myproject:1.55.8-SNAPSHOT
      +-au.com.dius.pact.provider:spring:4.6.16
        +-au.com.dius.pact.provider:junit:4.6.16
          +-au.com.dius.pact:provider:4.6.16
            +-io.pact.plugin.driver:core:0.5.1
              +-org.apache.tika:tika-core:2.9.2
    and
    +-com.myprojecti:1.55.8-SNAPSHOT
      +-au.com.dius.pact.provider:spring:4.6.16
        +-au.com.dius.pact.provider:junit:4.6.16
          +-au.com.dius.pact.core:model:4.6.16
            +-org.apache.tika:tika-core:2.9.1
  • s

    Spencer

    02/11/2025, 3:34 PM
    @Spencer has left the channel
  • j

    Juan Park

    02/12/2025, 3:25 PM
    Hi folks, I'm using pact-jvm to generate the json contract as the consumer and using pact-go on the provider side to verify it. However, the verification is failing because the json contract generated by pact-jvm includes an auto-generated interaction key which isn't expected nor desired. It looks like pact-ffi removed key generation in 0.4.5. What is the recommendation here? Example:
    Copy code
    "interactions": [
        {
          "description": "List bundles request",
          "interactionMarkup": {
            "markup": [...]
          },
          "key": "5050049c",
          "pending": false,
          [...]
          "metadata": {
            "pact-jvm": {
            "version": "4.6.14"
          },
          "pactSpecification": {
            "version": "4.0"
          },
        }
    m
    r
    r
    • 4
    • 29
  • g

    GitHub

    02/14/2025, 12:56 AM
    Release - 4.6.17 New release published by rholshausen Bugfix Release • b365641 - fix: Only coerce strings to numbers when comparing headers and query parameters • 1b1cf84 - chore(compatibility-suite): Correct the shared steps after updating the compatibility suite • c3938b4 - chore: Fix compatibility-suite CI build • dea8fb7 - chore: Fix compatibility-suite CI build • 8c5b0b1 - fix: Only split values of known multi-value headers #1852 • d7d3030 - fix: Matching rule paths for fields with only digits should not be written as indices #1851 • 5dba442 - fix: Lambda based DSL stringType method did not match the old DSL #1850 • 287b16c - feat: Pass any transport config to the plugin in the test context under the transport_config key • 80d8a87 - chore: Add example of a test with a pending interaction pact-foundation/pact-jvm
  • h

    Haritima Haritima

    02/18/2025, 11:40 AM
    Hey there, I am new to Pact testing and am trying to write consumer side contract testing on our java SpringBoot application for graphql resquests The problem I am facing is that when I run all the tests it fails on some of the test on using static port. I assume it takes time to shutdown the previous mock connection and start new. Using a dynamic port works. I am trying to avoid using dynamic port. I have tried
    Executor.closeIdleConnections();
    with @afterEach tests but that doesnt work. Can someone please help with alternative solution to tear down the connection after each tests (edited)
    m
    • 2
    • 3
  • d

    Denys

    02/18/2025, 3:46 PM
    Hi team! I have a problem THIS IS MY TEST CLASS :
    Copy code
    @ExtendWith(PactConsumerTestExt.class)
    @PactTestFor(providerName = "P01823-TS-Trade-Store", pactVersion = PactSpecVersion.V4, providerType = ProviderType.SYNCH_MESSAGE)
    class GetTradesByFilterProductTypeFXFWDTest {
    
        ManagedChannel channel;
        @BeforeEach
        void setUp(MockServer mockServer) {
            System.setProperty("pact_do_not_track", "true");
    
        }
    
        ////////////////// 1. GetTradesByFilter product types
        @Pact(consumer = "P01819-ipa-mi")
        public V4Pact tradesByFilterProductTypeFXFWD(PactBuilder builder) {
            return builder
                    .usingPlugin("protobuf")
                    .expectsToReceive("a get trade by filter request", "core/interaction/synchronous-message")
                    .with(Map.of(
                            "pact:proto", filePath("proto/tsServiceV2.proto"),
                            "pact:content-type", "application/grpc",
                            "pact:proto-service", "TradeStoreService/GetTradesByFilter",
                            "pact:protobuf-config", Map.of(
                                    "additionalIncludes",
                                    List.of(filePath("proto/tsService.proto"))),
    
                            // Details on the request message
                            "request", Map.of(
                                    "productTypes",
                                    Map.of("value",
                                            "matching(equalTo, 'FXFWD')")),
    
                            // Details on the response
                            "response",
                            Map.of("trade_key",
                                    Map.of("product_type", "matching(equalTo, 'FXFWD')")))
                    ).toPact();
        }
    
    
        @Test
        @PactTestFor(pactMethod = "tradesByFilterProductTypeFXFWD")
        @MockServerConfig(implementation = MockServerImplementation.Plugin, registryEntry = "protobuf/transport/grpc")
        void testTradesByFilterProductTypeFXFWD(MockServer mockServer, V4Interaction.SynchronousMessages interaction) throws InvalidProtocolBufferException, InterruptedException {
            boolean success = false;
            ManagedChannel channel = ManagedChannelBuilder.forTarget("127.0.0.1:" + mockServer.getPort())
                    .usePlaintext()
                    .build();
            try {
                TradeStoreServiceGrpc.TradeStoreServiceBlockingStub stub = TradeStoreServiceGrpc.newBlockingStub(channel);
    
                ts.api.TsServiceV2.TradeFilter tradeFilter = ts.api.TsServiceV2.TradeFilter.parseFrom(interaction.getRequest().getContents().getValue());
    
                Iterator<TsService.Trade> responseTrade = stub.getTradesByFilter(tradeFilter);
    
                assertThat(responseTrade).as("getTradeByFilter is null").isNotNull();
            } finally {
                if (!success) {
                    channel.awaitTermination(10, TimeUnit.SECONDS);
                    channel.shutdown();
                }
            }
        }
        @Pact(consumer = "P01819-ipa-mi")
        public V4Pact tradesByFilterProductTypeFXFWDONE(PactBuilder builder) {
            return builder
                    .usingPlugin("protobuf")
                    .expectsToReceive("a get trade by filter request", "core/interaction/synchronous-message")
                    .with(Map.of(
                            "pact:proto", filePath("proto/tsServiceV2.proto"),
                            "pact:content-type", "application/grpc",
                            "pact:proto-service", "TradeStoreService/GetTradesByFilter",
                            "pact:protobuf-config", Map.of(
                                    "additionalIncludes",
                                    List.of(filePath("proto/tsService.proto"))),
    
                            // Details on the request message
                            "request", Map.of(
                                    "productTypes",
                                    Map.of("value",
                                            "matching(equalTo, 'FXFWD')")),
    
                            // Details on the response
                            "response",
                            Map.of("trade_key",
                                    Map.of("product_type", "matching(equalTo, 'FXFWD')")))
                    ).toPact();
        }
    
    
        @Test
        @PactTestFor(pactMethod = "tradesByFilterProductTypeFXFWDONE")
        @MockServerConfig(implementation = MockServerImplementation.Plugin, registryEntry = "protobuf/transport/grpc")
        void testTradesByFilterProductTypeFXFWDONE(MockServer mockServer, V4Interaction.SynchronousMessages interaction) throws InvalidProtocolBufferException, InterruptedException {
            boolean success = false;
            ManagedChannel channel = ManagedChannelBuilder.forTarget("127.0.0.1:" + mockServer.getPort())
                    .usePlaintext()
                    .build();
            try {
                TradeStoreServiceGrpc.TradeStoreServiceBlockingStub stub = TradeStoreServiceGrpc.newBlockingStub(channel);
    
                ts.api.TsServiceV2.TradeFilter tradeFilter = ts.api.TsServiceV2.TradeFilter.parseFrom(interaction.getRequest().getContents().getValue());
    
                Iterator<TsService.Trade> responseTrade = stub.getTradesByFilter(tradeFilter);
    
                assertThat(responseTrade).as("getTradeByFilter is null").isNotNull();
            } finally {
                if (!success) {
                    channel.awaitTermination(10, TimeUnit.SECONDS);
                    channel.shutdown();
                }
            }
        }
    }
    After running all class I have an error:
    2025-02-18 17:34:46,081 ERROR [main] [:] io.pact.plugins.jvm.core.DefaultPluginManager: Failed to initialise the plugin
    io.grpc.StatusRuntimeException: UNAVAILABLE: io exception at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:351) at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:332) at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:174) at io.pact.plugin.PactPluginGrpc$PactPluginBlockingStub.initPlugin(PactPluginGrpc.java:641) at io.pact.plugins.jvm.core.DefaultPluginManager.initPlugin$lambda$37(PluginManager.kt:913) at io.pact.plugins.jvm.core.DefaultPactPlugin.withGrpcStub(PluginManager.kt:267) at io.pact.plugins.jvm.core.DefaultPluginManager.initPlugin(PluginManager.kt:913) at io.pact.plugins.jvm.core.DefaultPluginManager.tryInitPlugin(PluginManager.kt:892) at io.pact.plugins.jvm.core.DefaultPluginManager.initialisePlugin(PluginManager.kt:866) at io.pact.plugins.jvm.core.DefaultPluginManager.loadPlugin(PluginManager.kt:419) at au.com.dius.pact.consumer.dsl.PactBuilder.usingPlugin(PactBuilder.kt:113) at au.com.dius.pact.consumer.dsl.PactBuilder.usingPlugin$default(PactBuilder.kt:110) at au.com.dius.pact.consumer.dsl.PactBuilder.usingPlugin(PactBuilder.kt) at com.ing.ipami.pact.product_type.GetTradesByFilterProductTypeFXFWDTest.tradesByFilterProductTypeFXFWDONE(GetTradesByFilterProductTypeFXFWDTest.java:101) Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: getsockopt: /[00000001]52748 Caused by: java.net.ConnectException: Connection refused: getsockopt Process finished with exit code 0 protobuf plugin V 0.5.4 is installed on my laptop Do you have any ideas why after running tested class PACT framework generated only one tested method inside contract/.json file? Thanks
    m
    • 2
    • 4
  • v

    vicky

    02/19/2025, 12:19 PM
    I am encountering an issue while running my provider tests in a Gradle Kotlin Spring Boot project. I have a contract with 10 test cases, and my provider tests are split across two files—one file covers 2 states, while the other handles 8 states. However, when I run my provider tests, the contract checks for all 10 states in each file instead of only the relevant ones. As a result, I get 10 passing tests but also 10 failing tests because each file is validating all the states, leading to incorrect failures. things i have already tried: 1. moving SpringBootTest to base call 2. https://stackoverflow.com/a/79264442 please help ASAP
    v
    m
    • 3
    • 2
  • h

    Haritima Haritima

    02/19/2025, 5:01 PM
    Hi there, need another help with my pact tests please The provider app(java springboot / Junit) that we have uses very different/ complex steps to initialise the application. The default pact provider verifier is not initialising it correctly and hence it fails while setting up the provider states. Is there a way I can point my pact verifier to already running provider app. (will initialise the provider seperately before executing the pact test)
    m
    • 2
    • 3
  • b

    Bas Dijkstra

    02/24/2025, 7:25 AM
    Quick question, but I can't find the answer in the docs and ChatGPT isn't helpful either: how can I set the Pact verifier output log level to DEBUG in Java? In other languages it's a configuration setting in the code but I can't find the right syntax. Thanks 🙂
    b
    m
    • 3
    • 8
  • s

    Shrinivas Khawase

    02/24/2025, 8:52 AM
    Hello Everyone , We have been trying to implement contract testing for android. We are using this library for it
    au.com.dius.pact.consumer:junit Version 4.6.14
    but we often get the error mentioned below which blocks our pipeline , has anyone else faced this ?Its not consistent but occurs randomly cc @Sitaram Appalla @Ramesh Kumar
    Copy code
    Failed to transform java-semver-0.9.0.jar (com.github.zafarkhaja:java-semver:0.9.0) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
          > Could not find java-semver-0.9.0.jar (com.github.zafarkhaja:java-semver:0.9.0).
            Searched in the following locations:
                <https://jitpack.io/com/github/zafarkhaja/java-semver/0.9.0/java-semver-0.9.0.jar>
    r
    r
    • 3
    • 4
1...1011121314Latest