-
Notifications
You must be signed in to change notification settings - Fork 203
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
Hamcrest matcher to verify a header #260
Comments
@dmzaytsev I will ask someone to take care of this task soon |
@dmzaytsev I set milestone here to |
@ekondrashev it's yours,please go ahead |
@davvd could you please let me know the budget here? |
@dmzaytsev is it |
@ekondrashev yes, it is |
@dmzaytsev perhaps you meant like
Could you please confirm? |
@ekondrashev you're right we could use this matcher like this
|
@dmzaytsev @ekondrashev I think in this case we should call it |
@yegor256 but an instance of HmRqHeader could check one header only. Isn't it ? |
@dmzaytsev yes, if we call it MatcherAssert.assertThat(
new RqWithHeaders(new RqFake(), "TestHeader: someValue")
new HmRqHeaders(Matchers.hasEntry("TestHeader", "someValue")
); I can even use it like this: MatcherAssert.assertThat(
new RqWithHeaders(new RqFake(), "TestHeader: someValue")
new HmRqHeaders(Matchers.iterableWithSize(1)))
); |
@yegor256 What do you mean by 'checks all headers'? In you example you are checking only one header. Could you please provide example usage for checking all headers? From my side - current implementation (#269) checks only one pair of key/value. This is related to the fact that for checking all headers we need to expect at With regard to second usage example: Isn't it pretty different matcher? Lets say we can overload constructor to expect So my point here is that for multiple value map matcher and checking size matcher it should be created different enhancement(s). |
@yegor256 @ekondrashev well I agree let's try this
According RFC 2616
I believe What do you think ? |
@dmzaytsev I would rather work with a map... |
@yegor256 what is the benefit a map in this case? |
@yegor256 Perhaps would be better to create a type e.g. |
@dmzaytsev I see three scenarios:
How would you do them all with |
@yegor256
we can do so
however according RFC 2616 header should have only one value. |
|
@dmzaytsev thank you for the ticket reported, I topped your account for 15 mins, transaction |
@davvd The enhancement is in process of clarifying the requirements, can't proceed. |
@davvd looks like we need more time here |
@yegor256 @dmzaytsev Any updates on enhancement requirements? |
@yegor256 could you please provide final decision here? |
@ekondrashev sorry about the delay. this is how it should be (final decision): public final class HmRqHeader extends TypeSafeMatcher<Request> {
public HmRqHeader(final Matcher<? extends Map.Entry<String,String>> mtchr);
public HmRqHeader(final String header, final Matcher<? extends Iterable<String>> mtchr);
public HmRqHeader(final String header, final String value);
}
public final class HmRsHeader extends TypeSafeMatcher<Response> {
public HmRsHeader(final Matcher<? extends Map.Entry<String,String>> mtchr);
public HmRsHeader(final String header, final Matcher<? extends Iterable<String>> mtchr);
public HmRsHeader(final String header, final String value);
} |
@dmzaytsev these 2 puzzles were created in this ticket: |
@yegor256 I started work on #413 to implement constructors defined by you in 260#issuecomment-139857888. It is not possible to implement all five of them in Java due to language limitation described in Method has the same erasure as another method in type. Constructor public HmRsHeader(final Matcher<? extends Map<String,String>> mtchr); clashes with public HmRsHeader(final Matcher<? extends Map.Entry<String,String>> mtchr); and public HmRsHeader(final String header, final Matcher<? extends Iterable<String>> mtchr); clashes with public HmRsHeader(final String header, final Matcher<? extends String> mtchr); so we can implement only three of the five listed. Please decide which three of them we should implement or update your decision in other way. |
@prondzyn updated, see above |
@dmzaytsev the last puzzle |
@dmzaytsev can we close this issue please? |
@ekondrashev sure, thanks |
@elenavolokhova please, review this task for compliance with our quality rules |
@davvd Looks good! |
@elenavolokhova thanks a lot :) |
@ekondrashev 10 mins was added to the account of @elenavolokhova (for QA review), in transaction 90067139 thanks, paid, 30 mins to your account, payment ID is +30 to your rating, your total score is +1212 |
Takes doesn't has a Hamcrest matcher to verify a header. I think it has to be.
Both request and response headers need to be verified.
something like this
- ~~`260-1c71c6a2`/#412~~ (by Dragan Bozanovic) - `260-de67913e`/#413 (by Dragan Bozanovic)
The text was updated successfully, but these errors were encountered: