Skip to content

Conversation

@rjayasinghe
Copy link

No description provided.

@rjayasinghe rjayasinghe requested review from beckermarc and davidhunglam and removed request for beckermarc December 9, 2025 10:33
Copy link
Contributor

@davidhunglam davidhunglam left a 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.

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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify the list size?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

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?

Copy link
Contributor

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.

}

@After(event = EVENT_CREATE)
void setTotalPriceAfterCreation(Travels travels) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should showcase a calculated field in an @after handler. You should rather calculate the field in a @before handler to avoid an additional db roundtrip.

Copy link
Contributor

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?

Copy link
Collaborator

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.

Copy link
Contributor

@davidhunglam davidhunglam Dec 16, 2025

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

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

Successfully merging this pull request may close these issues.

4 participants