Use AssertJ's isEmpty() instead of hasSize(0)

Achieved via global search-and-replace.
This commit is contained in:
Sam Brannen
2022-11-22 17:11:50 +01:00
parent d5b0b2b1a1
commit 7fcd1de8e3
79 changed files with 260 additions and 295 deletions

View File

@@ -619,9 +619,9 @@ public class HttpHeadersTests {
// clear()
keySet.clear();
assertThat(keySet.isEmpty()).isTrue();
assertThat(keySet).hasSize(0);
assertThat(keySet).isEmpty();
assertThat(headers.isEmpty()).isTrue();
assertThat(headers).hasSize(0);
assertThat(headers).isEmpty();
// Unsupported operations
assertThatExceptionOfType(UnsupportedOperationException.class)

View File

@@ -155,7 +155,7 @@ public class ServletServerHttpRequestTests {
void getHeadersWithWildcardContentType() {
mockRequest.setContentType("*/*");
mockRequest.removeHeader("Content-Type");
assertThat(request.getHeaders()).as("Invalid content-type should not raise exception").hasSize(0);
assertThat(request.getHeaders()).as("Invalid content-type should not raise exception").isEmpty();
}
@Test

View File

@@ -66,7 +66,7 @@ class ChannelSendOperatorTests {
assertThat(signal).isNotNull();
assertThat(signal.isOnComplete()).as("Unexpected signal: " + signal).isTrue();
assertThat(this.writer.items).hasSize(0);
assertThat(this.writer.items).isEmpty();
assertThat(this.writer.completed).isTrue();
}

View File

@@ -110,7 +110,7 @@ class HeadersAdaptersTests {
headers.add("TestHeader", "first");
assertThat(headers.keySet()).hasSize(1);
headers.keySet().removeIf("TestHeader"::equals);
assertThat(headers.keySet()).hasSize(0);
assertThat(headers.keySet()).isEmpty();
}
@ParameterizedHeadersTest

View File

@@ -53,7 +53,7 @@ public class ServerHttpRequestTests {
@Test
public void queryParamsNone() throws Exception {
MultiValueMap<String, String> params = createRequest("/path").getQueryParams();
assertThat(params).hasSize(0);
assertThat(params).isEmpty();
}
@Test

View File

@@ -63,7 +63,7 @@ public class WebUtilsTests {
MultiValueMap<String, String> variables;
variables = WebUtils.parseMatrixVariables(null);
assertThat(variables).hasSize(0);
assertThat(variables).isEmpty();
variables = WebUtils.parseMatrixVariables("year");
assertThat(variables).hasSize(1);

View File

@@ -577,7 +577,7 @@ public class PathPatternTests {
pri = getPathRemaining(pp, "/aaa/bbb");
assertThat(pri.getPathRemaining().value()).isEqualTo("");
assertThat(pri.getPathMatched().value()).isEqualTo("/aaa/bbb");
assertThat(pri.getUriVariables()).hasSize(0);
assertThat(pri.getUriVariables()).isEmpty();
pp = parse("/*/{foo}/b*");
pri = getPathRemaining(pp, "/foo");
@@ -807,7 +807,7 @@ public class PathPatternTests {
assertThat((Object) checkCapture("/{one}/", "//")).isNull();
assertThat((Object) checkCapture("", "/abc")).isNull();
assertThat(checkCapture("", "").getUriVariables()).hasSize(0);
assertThat(checkCapture("", "").getUriVariables()).isEmpty();
checkCapture("{id}", "99", "id", "99");
checkCapture("/customer/{customerId}", "/customer/78", "customerId", "78");
checkCapture("/customer/{customerId}/banana", "/customer/42/banana", "customerId",
@@ -817,7 +817,7 @@ public class PathPatternTests {
"apple");
checkCapture("/{bla}.*", "/testing.html", "bla", "testing");
PathPattern.PathMatchInfo extracted = checkCapture("/abc", "/abc");
assertThat(extracted.getUriVariables()).hasSize(0);
assertThat(extracted.getUriVariables()).isEmpty();
checkCapture("/{bla}/foo","/a/foo");
}