-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Closes #1882 - Enable multi value pattern matching for DateTime #1925
Closes #1882 - Enable multi value pattern matching for DateTime #1925
Conversation
klaasdellschaft
commented
Jul 12, 2022
- Adding failing test cases
- Apply a fix for the failing test cases
- Adding failing test cases - Apply a fix for the failing test cases
This PR fixes #1882 I added several test cases that were originally failing, and which are then fixed by this PR. The problem described in #1882 occurs when doing any kind of DateTime matching on potentially multi valued fields like query parameters or headers. If the actual request does not contain any such value (i.e. query parameter or header value is missing), then the absent multi value field is translated into a list that contains a single null value. Thus, the different DateTimePatterns need to be able to gracefully handle the situation where the From my point of view, an open question is which distance is to be expected when comparing an expected DateTime to a missing DateTime. I decided for keeping the currently computed value where |
Hey @klaasdellschaft thanks for submitting this. Generally it looks great. The main change that's needed is that a non-match should result in distance 1.0 rather than a negative, since distance is normalised to between 0 and 1, and where we can't realistically do a distance calculation we set the value to 1 e.g. https://github.com/wiremock/wiremock/blob/master/src/main/java/com/github/tomakehurst/wiremock/matching/MatchesJsonPathPattern.java#L53 Also, please could you run |
Hi @tomakehurst thanks for the feedback. Pushed my changes to address your review. If you like, I can also squash the two commits before you merge. |
2de57a3
to
27310d2
Compare
Hi @tomakehurst after I saw the failing pipeline, I applied the spotless check again. Overall, I had to call |
That's strange, you should only have to apply it once. I've never seen it need more than one run. Was there any particular pattern to the changes it was making? Or is there any chance your IDE was reverting/auto-formatting stuff in the background or something like that? |
The "unstableness" was related to the reordering and reorganizing of the import statements. I did not watch out for a particular pattern. IDE auto-formatting may have influenced the commit / push (I will check and adapt my "on-commit" settings in the IDE) but I observed the unstableness on the Gradle command line where the IDE should not have jumped in because it did not see the changes yet. I will double and triple check now so that hopefully the next try of passing the spotless check in the pipeline is my last try. |
- Use "1.0" as match distance where realistically no distance can be calculated - Apply Spotless checks
27310d2
to
5d92eea
Compare
OK, now I did the |
Thanks! |