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

@@ -161,7 +161,7 @@ class ResourceHandlerRegistryTests {
assertThat(resolvers.get(1)).isInstanceOf(PathResourceResolver.class);
List<ResourceTransformer> transformers = handler.getResourceTransformers();
assertThat(transformers).hasSize(0);
assertThat(transformers).isEmpty();
}
@Test

View File

@@ -71,7 +71,7 @@ public class ViewResolverRegistryTests {
@Test
public void noResolvers() {
assertThat(this.registry.getViewResolvers()).isNotNull();
assertThat(this.registry.getViewResolvers()).hasSize(0);
assertThat(this.registry.getViewResolvers()).isEmpty();
assertThat(this.registry.hasRegistrations()).isFalse();
}

View File

@@ -56,7 +56,7 @@ public class RequestMappingInfoTests {
PathPattern emptyPattern = (new PathPatternParser()).parse("");
assertThat(info.getPatternsCondition().getPatterns()).isEqualTo(Collections.singleton(emptyPattern));
assertThat(info.getMethodsCondition().getMethods()).hasSize(0);
assertThat(info.getMethodsCondition().getMethods()).isEmpty();
assertThat(info.getConsumesCondition().isEmpty()).isTrue();
assertThat(info.getProducesCondition().isEmpty()).isTrue();
assertThat(info.getParamsCondition()).isNotNull();

View File

@@ -141,7 +141,7 @@ public class ModelInitializerTests {
WebSession session = this.exchange.getSession().block(Duration.ZERO);
assertThat(session).isNotNull();
assertThat(session.getAttributes()).hasSize(0);
assertThat(session.getAttributes()).isEmpty();
context.saveModel();
assertThat(session.getAttributes()).hasSize(1);
@@ -198,7 +198,7 @@ public class ModelInitializerTests {
context.getSessionStatus().setComplete();
context.saveModel();
assertThat(session.getAttributes()).hasSize(0);
assertThat(session.getAttributes()).isEmpty();
}

View File

@@ -173,7 +173,7 @@ public class ResponseEntityResultHandlerTests {
this.resultHandler.handleResult(exchange, result).block(Duration.ofSeconds(5));
assertThat(exchange.getResponse().getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
assertThat(exchange.getResponse().getHeaders()).hasSize(0);
assertThat(exchange.getResponse().getHeaders()).isEmpty();
assertResponseBodyIsEmpty(exchange);
}

View File

@@ -40,7 +40,7 @@ public class DefaultRenderingBuilderTests {
assertThat(rendering.view()).isEqualTo("abc");
assertThat(rendering.modelAttributes()).isEqualTo(Collections.emptyMap());
assertThat(rendering.status()).isNull();
assertThat(rendering.headers()).hasSize(0);
assertThat(rendering.headers()).isEmpty();
}
@Test