Use hasSize() assertion in favor of length checks

See gh-17874
This commit is contained in:
dreis2211
2019-08-15 09:36:29 +02:00
committed by Stephane Nicoll
parent 04b63cda8f
commit d4affd7f85
17 changed files with 36 additions and 37 deletions

View File

@@ -35,7 +35,6 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.ServletContextAware;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.nullValue;
/**
* Tests for {@link SpringBootMockServletContext}.
@@ -81,12 +80,12 @@ class SpringBootMockServletContextTests implements ServletContextAware {
}
};
URL resource = context.getResource("/");
assertThat(resource).isNotEqualTo(nullValue());
assertThat(resource).isNotNull();
File file = new File(URLDecoder.decode(resource.getPath(), "UTF-8"));
assertThat(file).exists().isDirectory();
String[] contents = file.list((dir, name) -> !(".".equals(name) || "..".equals(name)));
assertThat(contents).isNotEqualTo(nullValue());
assertThat(contents.length).isEqualTo(0);
assertThat(contents).isNotNull();
assertThat(contents).isEmpty();
}
@Configuration(proxyBeanMethods = false)