-
Notifications
You must be signed in to change notification settings - Fork 0
Tests #23
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
base: main
Are you sure you want to change the base?
Tests #23
Conversation
davidhunglam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some comments regarding the test expectations, not sure if we should verify a bit more than just the response code and the content format in some of them.
srv/src/main/java/sap/capire/xtravels/handler/RecalculatePriceHandler.java
Outdated
Show resolved
Hide resolved
srv/src/main/java/sap/capire/xtravels/handler/RecalculatePriceHandler.java
Outdated
Show resolved
Hide resolved
srv/src/test/java/sap/capire/xtravels/TravelServiceIntegrationTest.java
Outdated
Show resolved
Hide resolved
| mockMvc.perform(get(TRAVELS_ENDPOINT + "?$top=5&$skip=0")) | ||
| .andExpect(status().isOk()) | ||
| .andExpect(content().contentTypeCompatibleWith("application/json;charset=UTF-8")) | ||
| .andExpect(jsonPath("$.value", isA(java.util.List.class))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify the list size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you pushed any changes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also run one query that uses top=5&skip=0 and then one with top=4&skip=1 and compare the results. The result of the latter should have the same travel entities as the first query minus the first, then, right?
That would be a better test for both top and skip in my opinion.
…Handler.java Co-authored-by: David H Lam <david.lam@sap.com>
Co-authored-by: David H Lam <david.lam@sap.com>
| } | ||
|
|
||
| @After(event = EVENT_CREATE) | ||
| void setTotalPriceAfterCreation(Travels travels) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... now I wonder why Robin added this at all... isn't updating the total price already dealt with by updateTotalsOnPatch and updateTotalsOnDelete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think currently only for drafts, but not for requests that directly create an active entity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we should add this at the moment, as creating an active Travel entity would fail anyways, as the handler code for setting the booking pos also only exists for drafts.
I'd rather leave that out, as the PR was originally meant to add tests. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
No description provided.