Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The documentation for pact-jvm-consumer-junit5 contains an error. #298

Closed
Groos-dev opened this issue Nov 10, 2023 · 9 comments
Closed

The documentation for pact-jvm-consumer-junit5 contains an error. #298

Groos-dev opened this issue Nov 10, 2023 · 9 comments

Comments

@Groos-dev
Copy link

When I tried to run the tests using the Maven dependency(version 4.4.1) and code provided in the documentation, I encountered an error stating that "@PactConsumerTest" cannot be found. When I remove "@PactConsumerTest" and run the program,The following error occurred:
java.lang.UnsupportedOperationException: Method createPact does not conform required method signature 'public au.com.dius.pact.core.model.V4Pact xxx(PactBuilder builder)' I modified the example code as follows to resolve the issue:

@Pact(provider="ArticlesProvider", consumer="test_consumer")
  public V4Pact createPact(PactDslWithProvider builder) {
    return builder
        .given("test state")
        .uponReceiving("ExampleJavaConsumerPactTest test interaction")
        .path("/articles.json")
        .method("GET")
        .willRespondWith()
        .status(200)
        .body("{\"responsetest\": true}")
        .toPact(V4Pact.class);
  }
@YOU54F
Copy link
Member

YOU54F commented Nov 10, 2023

which page/doc in particular - can you provide a link to the example

@Groos-dev
Copy link
Author

which page/doc in particular - can you provide a link to the example
I'm very sorry that I couldn't describe the problem clearly, the link is https://docs.pact.io/implementation_guides/jvm/consumer/junit5

@YOU54F
Copy link
Member

YOU54F commented Nov 10, 2023

Thanks @Groos-dev

That document source is here https://github.com/pact-foundation/pact-jvm/blob/master/consumer/junit5/README.md

and is pulled in via a sync job, so one would to update the documentation via the link above.

I imagine this document actually needs updating to reflect a supported branch, currently the readme suggests

The library is available on maven central using:

group-id = au.com.dius.pact.consumer
artifact-id = junit5
version-id = 4.4.X

which is no longer a supported branch

https://github.com/pact-foundation/pact-jvm?tab=readme-ov-file#supported-jdk-and-specification-versions

Screenshot 2023-11-10 at 12 18 18

@YOU54F
Copy link
Member

YOU54F commented Nov 10, 2023

I'm very sorry that I couldn't describe the problem clearly, the link is https://docs.pact.io/implementation_guides/jvm/consumer/junit5

No problem 👍🏾, and thank you!

@YOU54F
Copy link
Member

YOU54F commented Nov 10, 2023

I think this issue would be worth transferring this to the pact-jvm repository, if you are happy with me doing that 👍🏾

@Groos-dev
Copy link
Author

谢谢 @Groos-dev

该文档来源位于 https://github.com/pact-foundation/pact-jvm/blob/master/consumer/junit5/README.md

并通过同步作业拉入,因此可以通过上面的链接更新文档。

我想这个文档实际上需要更新以反映支持的分支,目前自述文件 建议

该库可在 Maven Central 上使用:

组 ID = au.com.dius.pact.consumer
工件 ID = junit5
版本 ID = 4.4.X

它不再是受支持的分支

https://github.com/pact-foundation/pact-jvm?tab=readme-ov-file#supported-jdk-and-specification-versions

截图 2023-11-10 12 18 18

ok I get it, thanks!

@YOU54F
Copy link
Member

YOU54F commented Nov 10, 2023

BTW, I am just testing this out as part of a separate issue and I think you might need to explicitly set the pactVersion to V3

See below

import au.com.dius.pact.core.model.PactSpecVersion
@PactConsumerTest
@PactTestFor(providerName = "ArticlesProvider", pactVersion = PactSpecVersion.V3)

@Groos-dev
Copy link
Author

If I want to use the @PactConsumerTest annotation, which jar package do I need to import?

@YOU54F
Copy link
Member

YOU54F commented Apr 23, 2024

@YOU54F YOU54F closed this as completed Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants