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

AND is not a valid matcher definition #1070

Open
s1apped opened this issue Apr 15, 2020 · 8 comments
Open

AND is not a valid matcher definition #1070

s1apped opened this issue Apr 15, 2020 · 8 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@s1apped
Copy link

s1apped commented Apr 15, 2020

Hi,

I'm getting below warning when running consumer test using junit5
image

Tests are passing and contract looks correct

        return builder
                .given("This is a test")
                .uponReceiving("GET request to retrieve default values)
                .path(format("api\test\%s", "\\d{1,8}"))
                .method("GET")
                .willRespondWith()
                .status(200)
                .headers(RESPONSE_HEADERS_JSON)
                .body(newJsonArrayMinLike(1, values -> values.object(value -> {
                            value.numberType("id", 32432);
                            value.stringType("name", "testId254");
                            value.numberType("size", 1445211);
                        }
                )).build())
                .toPact();

Any idea? Thanks

@uglyog
Copy link
Member

uglyog commented Apr 18, 2020

What version of Pact-JVM are you using?

@s1apped
Copy link
Author

s1apped commented Apr 18, 2020

@uglyog 4.0.9. I have moved from 4.0.4 where I was also getting these warning.

@uglyog
Copy link
Member

uglyog commented Apr 18, 2020

I am unable to replicate this. I created a test with that code, but do not get any warnings.

BTW, I am unsure of the line .path(format("api\test\%s", "\\d{1,8}")), should it not be .matchPath(format("/api/test/%s", "\\d{1,8}"))?

@s1apped
Copy link
Author

s1apped commented Apr 20, 2020

@uglyog I have copied your tests and still got the warning
image

Can it be something with dependencies?
plugins {
id "au.com.dius.pact" version '4.0.10'
}
testImplementation(
'org.junit.jupiter:junit-jupiter:5.6.0',
'au.com.dius:pact-jvm-consumer-junit5:4.0.10',
'au.com.dius:pact-jvm-consumer-java8:4.0.10'
)

@uglyog
Copy link
Member

uglyog commented Apr 26, 2020

Your dependencies are fine. Can you provide the pact file? There must be invalid matchers in the file.

@s1apped
Copy link
Author

s1apped commented Apr 28, 2020

@uglyog please see attached. I found that when test is executed first time there is no warning but once the pact file exists and test is executed warning is displayed.
ApiConsumer-ApiProvider.zip

@uglyog
Copy link
Member

uglyog commented May 2, 2020

Ah, the warning occurs when it loads in the existing Pact file to merge in the test results!

@uglyog uglyog added the bug Indicates an unexpected problem or unintended behavior label May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants