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

PP-6085 Add accept header to test #581

Merged
merged 1 commit into from
Feb 7, 2020

Conversation

danworth
Copy link
Contributor

@danworth danworth commented Feb 7, 2020

There are two methods within TransactionResource named search and
streamCsv. Both use the path / and http method GET but provide
either "application/json" or "text/csv" respectively.

According to the jax-rs specification when the client does not specify
the "accept" header then it is not garanteed as to which method will be
invoked, since both methods have the same level of specificity in what
they provide.

When
shouldReturn400IfTransactionGatewayAccountIdIsNotProvidedForSearch
runs locally and on Jenkins the search method is invoked as expected,
however on Travis streamCsv is called and an NPE is thrown as the test
provides a mock config with null parameters.

This shouldn't be a concern in production since the client of this
service is publicApi which provides an accept header. Therefore we feel it is
exceptable to add the header to the test and not disambiguate the
two methods any further.

@danworth danworth force-pushed the PP-6085_add_accept_header_to_test branch from b5f39f5 to bafe122 Compare February 7, 2020 11:26
There are two methods within `TransactionResource` named `search` and
`streamCsv`. Both use the path `/` and http method `GET` but provide
either "application/json" or "text/csv" respectively.

According to the jax-rs specification when the client does not specify
the "accept" header then it is not garanteed as to which method will be
invoked, since both methods have the same level of specificity in what
they provide.

When
`shouldReturn400IfTransactionGatewayAccountIdIsNotProvidedForSearch`
runs locally and on Jenkins the `search` method is invoked as expected,
however on Travis `streamCsv` is called and an NPE is thrown as the test
provides a mock config with null parameters.

This shouldn't be a concern in production since the client of this
service is publicApi which provides an accept header. Therefore we feel it is
exceptable to add the header to the test and not disambiguate the
two methods any further.
Copy link
Contributor

@richardTowers richardTowers left a comment

Choose a reason for hiding this comment

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

Looks good to me - once Travis is happy 👍

@danworth danworth merged commit 9c3315d into master Feb 7, 2020
@danworth danworth deleted the PP-6085_add_accept_header_to_test branch February 7, 2020 11:37
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.

3 participants