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

valueFromProviderState method cannot verify values in number type #1061

Closed
tainguyenvn opened this issue Mar 27, 2020 · 5 comments
Closed

valueFromProviderState method cannot verify values in number type #1061

tainguyenvn opened this issue Mar 27, 2020 · 5 comments

Comments

@tainguyenvn
Copy link

tainguyenvn commented Mar 27, 2020

.body(new PactDslJsonBody()
     .valueFromProviderState("accountId", "${accountId}", 123))
dependencies {
compile 'au.com.dius:pact-jvm-provider-junit_2.12:3.6.14'
}

In fact, the data type of "accountId" is number, but values injected from the provider states are parsed as an expression, which will always be a string. So the pact verification always fails.

Please help to update framework verify values in number type.
Thanks

@uglyog
Copy link
Member

uglyog commented Apr 4, 2020

If you don't use an expression, it will use the raw value from the state change callback. I.e.,

.body(new PactDslJsonBody()
     .valueFromProviderState("accountId", "accountId", 123))

@uglyog
Copy link
Member

uglyog commented Apr 5, 2020

Version 4.0.9 should now work as expected

@tainguyenvn
Copy link
Author

@uglyog Is there any way to fix in branch of 3.6.14 because my pacts were created in that version? Thanks so much

uglyog pushed a commit that referenced this issue Apr 29, 2020
uglyog pushed a commit that referenced this issue Apr 29, 2020
uglyog pushed a commit that referenced this issue Apr 29, 2020
(cherry picked from commit fe33c75)
@uglyog
Copy link
Member

uglyog commented Apr 29, 2020

3.6.15 has been released

@tainguyenvn
Copy link
Author

Thanks so much @uglyog

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