Polish Tests and Error Messages

MockMvc matchers are best matched with the MockMvc execution API -
it's a little odd to try and use them inside of an AssertJ assertion
since they do their own asserting.

It's more readable to place "this." in front of member variables.

It's best to test just one class at a time in a unit test.

Issue: gh-4187
This commit is contained in:
Josh Cummings
2019-02-28 10:51:04 -07:00
parent 82d527ed42
commit d86550f64b
4 changed files with 26 additions and 71 deletions

View File

@@ -38,7 +38,7 @@ public final class HeaderWriterLogoutHandler implements LogoutHandler {
* @throws {@link IllegalArgumentException} if headerWriter is null.
*/
public HeaderWriterLogoutHandler(HeaderWriter headerWriter) {
Assert.notNull(headerWriter, "headerWriter cannot be null.");
Assert.notNull(headerWriter, "headerWriter cannot be null");
this.headerWriter = headerWriter;
}

View File

@@ -67,7 +67,7 @@ public final class ClearSiteDataHeaderWriter implements HeaderWriter {
* @throws {@link IllegalArgumentException} if sources is null or empty.
*/
public ClearSiteDataHeaderWriter(String ...sources) {
Assert.notEmpty(sources, "Sources cannot be empty or null.");
Assert.notEmpty(sources, "sources cannot be empty or null");
this.requestMatcher = new SecureRequestMatcher();
this.headerValue = Stream.of(sources).map(this::quote).collect(Collectors.joining(", "));
}