Polishing

This commit is contained in:
Juergen Hoeller
2018-09-29 17:36:15 +02:00
parent a21ce42558
commit d90d65bad2
2 changed files with 13 additions and 13 deletions

View File

@@ -356,15 +356,13 @@ public abstract class AbstractApplicationEventMulticaster
*/
private class ListenerRetriever {
public final Set<ApplicationListener<?>> applicationListeners;
public final Set<ApplicationListener<?>> applicationListeners = new LinkedHashSet<>();
public final Set<String> applicationListenerBeans;
public final Set<String> applicationListenerBeans = new LinkedHashSet<>();
private final boolean preFiltered;
public ListenerRetriever(boolean preFiltered) {
this.applicationListeners = new LinkedHashSet<>();
this.applicationListenerBeans = new LinkedHashSet<>();
this.preFiltered = preFiltered;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import static org.springframework.core.env.AbstractEnvironment.*;
* @author Chris Beams
* @author Juergen Hoeller
*/
@SuppressWarnings("deprecation")
public class StandardEnvironmentTests {
private static final String ALLOWED_PROPERTY_NAME = "theanswer";
@@ -51,7 +52,8 @@ public class StandardEnvironmentTests {
private static final Object NON_STRING_PROPERTY_NAME = new Object();
private static final Object NON_STRING_PROPERTY_VALUE = new Object();
private ConfigurableEnvironment environment = new StandardEnvironment();
private final ConfigurableEnvironment environment = new StandardEnvironment();
@Test
public void merge() {
@@ -131,12 +133,12 @@ public class StandardEnvironmentTests {
@Test(expected = IllegalArgumentException.class)
public void setActiveProfiles_withNullProfileArray() {
environment.setActiveProfiles((String[])null);
environment.setActiveProfiles((String[]) null);
}
@Test(expected = IllegalArgumentException.class)
public void setActiveProfiles_withNullProfile() {
environment.setActiveProfiles((String)null);
environment.setActiveProfiles((String) null);
}
@Test(expected = IllegalArgumentException.class)
@@ -151,12 +153,12 @@ public class StandardEnvironmentTests {
@Test(expected = IllegalArgumentException.class)
public void setDefaultProfiles_withNullProfileArray() {
environment.setDefaultProfiles((String[])null);
environment.setDefaultProfiles((String[]) null);
}
@Test(expected = IllegalArgumentException.class)
public void setDefaultProfiles_withNullProfile() {
environment.setDefaultProfiles((String)null);
environment.setDefaultProfiles((String) null);
}
@Test(expected = IllegalArgumentException.class)
@@ -270,12 +272,12 @@ public class StandardEnvironmentTests {
@Test(expected = IllegalArgumentException.class)
public void acceptsProfiles_withNullArgumentList() {
environment.acceptsProfiles((String[])null);
environment.acceptsProfiles((String[]) null);
}
@Test(expected = IllegalArgumentException.class)
public void acceptsProfiles_withNullArgument() {
environment.acceptsProfiles((String)null);
environment.acceptsProfiles((String) null);
}
@Test(expected = IllegalArgumentException.class)
@@ -283,7 +285,6 @@ public class StandardEnvironmentTests {
environment.acceptsProfiles("");
}
@Test
public void acceptsProfiles_activeProfileSetProgrammatically() {
assertThat(environment.acceptsProfiles("p1", "p2"), is(false));
@@ -488,6 +489,7 @@ public class StandardEnvironmentTests {
getModifiableSystemEnvironment().remove(DISALLOWED_PROPERTY_NAME);
}
@SuppressWarnings("unchecked")
public static Map<String, String> getModifiableSystemEnvironment() {
// for os x / linux