-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add tests for containsHeaderString #1238
Add tests for containsHeaderString #1238
Conversation
7a89e78
to
a3a65b2
Compare
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.
Should we also be testing the Container*Context
and HttpHeaders
as well since they both include these methods too?
jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientRequestContext.java
Outdated
Show resolved
Hide resolved
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/client/clientrequestcontext/JAXRSClientIT.java
Outdated
Show resolved
Hide resolved
7c2aeb2
to
4c2d374
Compare
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/client/clientrequestcontext/JAXRSClientIT.java
Outdated
Show resolved
Hide resolved
2df867c
to
c504dde
Compare
...s-tck/src/main/java/ee/jakarta/tck/ws/rs/api/client/clientresponsecontext/JAXRSClientIT.java
Outdated
Show resolved
Hide resolved
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/ee/rs/core/headers/HttpHeadersTest.java
Outdated
Show resolved
Hide resolved
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/ee/rs/core/headers/HttpHeadersTest.java
Outdated
Show resolved
Hide resolved
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/ee/rs/core/headers/JAXRSClientIT.java
Show resolved
Hide resolved
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/client/clientrequestcontext/JAXRSClientIT.java
Outdated
Show resolved
Hide resolved
protected void checkFilterContext(ClientRequestContext context) throws Fault { | ||
assertTrue(context.containsHeaderString("header1", "value"::equalsIgnoreCase)); | ||
assertTrue(context.containsHeaderString("HEADER1", ",", "value2"::equals)); | ||
//Incorrect separator character |
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.
IMHO a TCK test should only test for the existence of a given rule, not for the absence of particular bugs.
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 this test is valid since it confirms that the value of the separator character parameter is actually used and taken into consideration by the impl.
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.
"Incorrect separator character" does not imply that. Checking for correct pickup of separator is implied in line 879 already.
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.
Line 879 only proves that the line separator parameter can be included in the invocation, but not that it is actually used by the impl. The impl could be ignoring that parameter and accepting any separator character as valid. This is why the "incorrect separator character" test is good. It tests that the impl is using the the separator parameter and that it is checking it specifically and not just allowing any separator.
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 wonder if instead there could be a test that actively checks usage of the separator, and positively comments about that.
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 see your point, I'm just not sure there is a way to ensure that the separator parameter is actually being used without having at lease one test that expects failure in that respect.
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.
To me the test makes sense. If you split with the wrong separator (so you don't really split) then the assertion is false.
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.
That is correct, but just because using the wrong separator fails the test does not imply that using the correct separator passes the test.
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/client/clientrequestcontext/JAXRSClientIT.java
Outdated
Show resolved
Hide resolved
jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/client/clientrequestcontext/JAXRSClientIT.java
Outdated
Show resolved
Hide resolved
5527020
to
585b81f
Compare
…change to clarify javadoc from code review.
585b81f
to
73d7cbc
Compare
73d7cbc
to
78208ee
Compare
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.
This looks good to me. There are a couple spots where there are some whitespace only changes, but I don't want to block this PR based on that.
f75ab59
to
f70e010
Compare
...s-tck/src/main/java/ee/jakarta/tck/ws/rs/ee/rs/container/responsecontext/ResponseFilter.java
Outdated
Show resolved
Hide resolved
f70e010
to
ac9837b
Compare
@mkarg Your change request is now blocking this PR |
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 am not used to writing TCK tests, so I am not actively voting +1, but feel free to proceed anyways.
protected void checkFilterContext(ClientRequestContext context) throws Fault { | ||
assertTrue(context.containsHeaderString("header1", "value"::equalsIgnoreCase)); | ||
assertTrue(context.containsHeaderString("HEADER1", ",", "value2"::equals)); | ||
//Incorrect separator character |
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.
That is correct, but just because using the wrong separator fails the test does not imply that using the correct separator passes the test.
Addresses #1227
Awaiting formal testing.