Use AssertJ's isEmpty() instead of hasSize(0)
Achieved via global search-and-replace.
This commit is contained in:
@@ -273,7 +273,7 @@ class MockHttpServletRequestTests {
|
||||
request.addParameters(params);
|
||||
assertThat(request.getParameterMap()).hasSize(3);
|
||||
request.removeAllParameters();
|
||||
assertThat(request.getParameterMap()).hasSize(0);
|
||||
assertThat(request.getParameterMap()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -180,7 +180,7 @@ class MockServletContextTests {
|
||||
void getServletRegistrations() {
|
||||
Map<String, ? extends ServletRegistration> servletRegistrations = servletContext.getServletRegistrations();
|
||||
assertThat(servletRegistrations).isNotNull();
|
||||
assertThat(servletRegistrations).hasSize(0);
|
||||
assertThat(servletRegistrations).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,7 +198,7 @@ class MockServletContextTests {
|
||||
void getFilterRegistrations() {
|
||||
Map<String, ? extends FilterRegistration> filterRegistrations = servletContext.getFilterRegistrations();
|
||||
assertThat(filterRegistrations).isNotNull();
|
||||
assertThat(filterRegistrations).hasSize(0);
|
||||
assertThat(filterRegistrations).isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class TestContextConcurrencyTests {
|
||||
});
|
||||
assertThat(actualMethods).isEqualTo(expectedMethods);
|
||||
});
|
||||
assertThat(tcm.getTestContext().attributeNames()).hasSize(0);
|
||||
assertThat(tcm.getTestContext().attributeNames()).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class AnnotationConfigContextLoaderUtilsTests {
|
||||
void detectDefaultConfigurationClassesWithoutConfigurationClass() {
|
||||
Class<?>[] configClasses = detectDefaultConfigurationClasses(NoConfigTestCase.class);
|
||||
assertThat(configClasses).isNotNull();
|
||||
assertThat(configClasses).hasSize(0);
|
||||
assertThat(configClasses).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -340,8 +340,8 @@ class ContextLoaderUtilsContextHierarchyTests extends AbstractContextConfigurati
|
||||
assertThat(alphaConfig).hasSize(2);
|
||||
assertThat(alphaConfig.get(0).getLocations()).hasSize(1);
|
||||
assertThat(alphaConfig.get(0).getLocations()[0]).isEqualTo("1-A.xml");
|
||||
assertThat(alphaConfig.get(0).getInitializers()).hasSize(0);
|
||||
assertThat(alphaConfig.get(1).getLocations()).hasSize(0);
|
||||
assertThat(alphaConfig.get(0).getInitializers()).isEmpty();
|
||||
assertThat(alphaConfig.get(1).getLocations()).isEmpty();
|
||||
assertThat(alphaConfig.get(1).getInitializers()).hasSize(1);
|
||||
assertThat(alphaConfig.get(1).getInitializers()[0]).isEqualTo(DummyApplicationContextInitializer.class);
|
||||
|
||||
@@ -349,8 +349,8 @@ class ContextLoaderUtilsContextHierarchyTests extends AbstractContextConfigurati
|
||||
assertThat(betaConfig).hasSize(2);
|
||||
assertThat(betaConfig.get(0).getLocations()).hasSize(1);
|
||||
assertThat(betaConfig.get(0).getLocations()[0]).isEqualTo("1-B.xml");
|
||||
assertThat(betaConfig.get(0).getInitializers()).hasSize(0);
|
||||
assertThat(betaConfig.get(1).getLocations()).hasSize(0);
|
||||
assertThat(betaConfig.get(0).getInitializers()).isEmpty();
|
||||
assertThat(betaConfig.get(1).getLocations()).isEmpty();
|
||||
assertThat(betaConfig.get(1).getInitializers()).hasSize(1);
|
||||
assertThat(betaConfig.get(1).getInitializers()[0]).isEqualTo(DummyApplicationContextInitializer.class);
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class TestPropertySourceUtilsTests {
|
||||
|
||||
MutablePropertySources propertySources = environment.getPropertySources();
|
||||
propertySources.remove(MockPropertySource.MOCK_PROPERTIES_PROPERTY_SOURCE_NAME);
|
||||
assertThat(propertySources).hasSize(0);
|
||||
assertThat(propertySources).isEmpty();
|
||||
|
||||
String pair = "key = value";
|
||||
ByteArrayResource resource = new ByteArrayResource(pair.getBytes(), "from inlined property: " + pair);
|
||||
@@ -275,10 +275,10 @@ class TestPropertySourceUtilsTests {
|
||||
ConfigurableEnvironment environment = new MockEnvironment();
|
||||
MutablePropertySources propertySources = environment.getPropertySources();
|
||||
propertySources.remove(MockPropertySource.MOCK_PROPERTIES_PROPERTY_SOURCE_NAME);
|
||||
assertThat(propertySources).hasSize(0);
|
||||
assertThat(propertySources).isEmpty();
|
||||
addInlinedPropertiesToEnvironment(environment, asArray(" "));
|
||||
assertThat(propertySources).hasSize(1);
|
||||
assertThat(((Map<?, ?>) propertySources.iterator().next().getSource())).hasSize(0);
|
||||
assertThat(((Map<?, ?>) propertySources.iterator().next().getSource())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -46,7 +46,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(response.getHeaders().isEmpty()).isTrue();
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -77,7 +77,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||
assertThat(response.getHeaders().getLocation()).isEqualTo(location);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -86,7 +86,7 @@ class ResponseCreatorsTests {
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.ACCEPTED);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -96,7 +96,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||
assertThat(response.getHeaders().isEmpty()).isTrue();
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -106,7 +106,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
assertThat(response.getHeaders().isEmpty()).isTrue();
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -116,7 +116,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
|
||||
assertThat(response.getHeaders().isEmpty()).isTrue();
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -125,7 +125,7 @@ class ResponseCreatorsTests {
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -134,7 +134,7 @@ class ResponseCreatorsTests {
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,7 +143,7 @@ class ResponseCreatorsTests {
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CONFLICT);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -153,7 +153,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.TOO_MANY_REQUESTS);
|
||||
assertThat(response.getHeaders()).doesNotContainKey(HttpHeaders.RETRY_AFTER);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -163,7 +163,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.TOO_MANY_REQUESTS);
|
||||
assertThat(response.getHeaders().getFirst(HttpHeaders.RETRY_AFTER)).isEqualTo("512");
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -173,7 +173,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
assertThat(response.getHeaders().isEmpty()).isTrue();
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -182,7 +182,7 @@ class ResponseCreatorsTests {
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.BAD_GATEWAY);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -191,7 +191,7 @@ class ResponseCreatorsTests {
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -200,7 +200,7 @@ class ResponseCreatorsTests {
|
||||
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.GATEWAY_TIMEOUT);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -210,7 +210,7 @@ class ResponseCreatorsTests {
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN);
|
||||
assertThat(response.getHeaders().isEmpty()).isTrue();
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
|
||||
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user