-
Notifications
You must be signed in to change notification settings - Fork 6k
Simplify MediaTypeRequestMatcher construction #6648
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
Conversation
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.
Thanks, @clevertension! I've left some inline feedback.
...rc/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherTests.java
Outdated
Show resolved
Hide resolved
web/src/main/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcher.java
Show resolved
Hide resolved
@jzheaux it's 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.
Thanks again, @clevertension! I've left just a bit more feedback inline.
Also, once you have that ready, will you please squash your commits so that there is only one in the PR? Thanks!
...rc/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherTests.java
Show resolved
Hide resolved
@@ -53,8 +53,8 @@ public void setup() { | |||
} | |||
|
|||
@Test(expected = IllegalArgumentException.class) | |||
public void constructorNullCNSVarargs() { | |||
new MediaTypeRequestMatcher(null, MediaType.ALL); | |||
public void constructorWhenNullCNSThenIAE() {ContentNegotiationStrategy c = null; |
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.
Will you please add the appropriate line break 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.
ok
@@ -189,6 +319,15 @@ public void useEqualsWithCustomMediaType() throws HttpMediaTypeNotAcceptableExce | |||
assertThat(matcher.matches(request)).isTrue(); | |||
} | |||
|
|||
@Test | |||
public void useEqualsWhenTrueThenCustomMediaTypeIsMatched() throws HttpMediaTypeNotAcceptableException { |
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.
A number of these tests don't actually throw an HttpMediaTypeNotAcceptableException
. Will you please remove the throws
from the signature where it is unnecessary? This way, the expectations of the test are clearer.
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.
ok
Thanks again, @clevertension! This is now merged into |
@jzheaux thanks very much for reviewing my code, i hope i can contribute more code 😃😃 |
I'd love that, @clevertension! Make sure to keep an eye out especially for tickets tagged with "help wanted" as those are usually ideal for community contributions. |
this PR will simplify MediaTypeRequestMatcher construction, just like
MediaTypeServerWebExchangeMatcher
see #6612