Polish some Collections API calls

See gh-17825
pull/17834/head
dreis2211 5 years ago committed by Stephane Nicoll
parent 6921e240bc
commit b605cddb10

@ -36,7 +36,7 @@ public class JndiPropertiesHidingClassLoader extends ClassLoader {
@Override
public Enumeration<URL> getResources(String name) throws IOException {
if ("jndi.properties".equals(name)) {
return Collections.enumeration(Collections.emptyList());
return Collections.emptyEnumeration();
}
return super.getResources(name);
}

@ -173,7 +173,7 @@ public class ExplodedArchive implements Archive {
private Iterator<File> listFiles(File file) {
File[] files = file.listFiles();
if (files == null) {
return Collections.<File>emptyList().iterator();
return Collections.emptyIterator();
}
Arrays.sort(files, this.entryComparator);
return Arrays.asList(files).iterator();

@ -129,7 +129,7 @@ class SpringBootServletInitializerTests {
given(servletContext.getInitParameterNames())
.willReturn(Collections.enumeration(Collections.singletonList("spring.profiles.active")));
given(servletContext.getInitParameter("spring.profiles.active")).willReturn("from-servlet-context");
given(servletContext.getAttributeNames()).willReturn(Collections.enumeration(Collections.emptyList()));
given(servletContext.getAttributeNames()).willReturn(Collections.emptyEnumeration());
try (ConfigurableApplicationContext context = (ConfigurableApplicationContext) new PropertySourceVerifyingSpringBootServletInitializer()
.createRootApplicationContext(servletContext)) {
assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("from-servlet-context");

Loading…
Cancel
Save