Polishing

This commit is contained in:
Juergen Hoeller
2016-07-26 17:15:15 +02:00
parent 7b564b72a1
commit e03dea1d64
193 changed files with 324 additions and 323 deletions

View File

@@ -28,7 +28,7 @@ import static org.junit.Assert.assertEquals;
* @author Rick Evans
* @author Stephane Nicoll
*/
public final class OrderComparatorTests {
public class OrderComparatorTests {
private final OrderComparator comparator = new OrderComparator();

View File

@@ -45,22 +45,22 @@ public class ConvertingComparatorTests {
private final TestComparator comparator = new TestComparator();
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void shouldThrowOnNullComparator() throws Exception {
new ConvertingComparator<>(null, this.converter);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void shouldThrowOnNullConverter() throws Exception {
new ConvertingComparator<String, Integer>(this.comparator, null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void shouldThrowOnNullConversionService() throws Exception {
new ConvertingComparator<String, Integer>(this.comparator, null, Integer.class);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void shouldThrowOnNullType() throws Exception {
new ConvertingComparator<String, Integer>(this.comparator,
this.conversionService, null);

View File

@@ -221,7 +221,7 @@ public class PropertySourcesPropertyResolverTests {
equalTo("Replace this value plus defaultValue"));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void resolvePlaceholders_withNullInput() {
new PropertySourcesPropertyResolver(new MutablePropertySources()).resolvePlaceholders(null);
}
@@ -234,7 +234,7 @@ public class PropertySourcesPropertyResolverTests {
assertThat(resolver.resolveRequiredPlaceholders("Replace this ${key}"), equalTo("Replace this value"));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void resolveRequiredPlaceholders_withUnresolvable() {
MutablePropertySources propertySources = new MutablePropertySources();
propertySources.addFirst(new MockPropertySource().withProperty("key", "value"));
@@ -251,7 +251,7 @@ public class PropertySourcesPropertyResolverTests {
equalTo("Replace this value plus defaultValue"));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void resolveRequiredPlaceholders_withNullInput() {
new PropertySourcesPropertyResolver(new MutablePropertySources()).resolveRequiredPlaceholders(null);
}

View File

@@ -60,25 +60,25 @@ public class SimpleCommandLineParserTests {
assertThat(args.getOptionValues("o3"), nullValue());
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void withEmptyOptionText() {
SimpleCommandLineArgsParser parser = new SimpleCommandLineArgsParser();
parser.parse("--");
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void withEmptyOptionName() {
SimpleCommandLineArgsParser parser = new SimpleCommandLineArgsParser();
parser.parse("--=v1");
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void withEmptyOptionValue() {
SimpleCommandLineArgsParser parser = new SimpleCommandLineArgsParser();
parser.parse("--o1=");
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void withEmptyOptionNameAndEmptyOptionValue() {
SimpleCommandLineArgsParser parser = new SimpleCommandLineArgsParser();
parser.parse("--=");
@@ -97,13 +97,13 @@ public class SimpleCommandLineParserTests {
assertThat(nonOptions.size(), equalTo(2));
}
@Test(expected=UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void assertOptionNamesIsUnmodifiable() {
CommandLineArgs args = new SimpleCommandLineArgsParser().parse();
args.getOptionNames().add("bogus");
}
@Test(expected=UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void assertNonOptionArgsIsUnmodifiable() {
CommandLineArgs args = new SimpleCommandLineArgsParser().parse();
args.getNonOptionArgs().add("foo");

View File

@@ -129,42 +129,42 @@ public class StandardEnvironmentTests {
assertThat(activeProfiles.length, is(2));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setActiveProfiles_withNullProfileArray() {
environment.setActiveProfiles((String[])null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setActiveProfiles_withNullProfile() {
environment.setActiveProfiles((String)null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setActiveProfiles_withEmptyProfile() {
environment.setActiveProfiles("");
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setActiveProfiles_withNotOperator() {
environment.setActiveProfiles("p1", "!p2");
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setDefaultProfiles_withNullProfileArray() {
environment.setDefaultProfiles((String[])null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setDefaultProfiles_withNullProfile() {
environment.setDefaultProfiles((String)null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setDefaultProfiles_withEmptyProfile() {
environment.setDefaultProfiles("");
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void setDefaultProfiles_withNotOperator() {
environment.setDefaultProfiles("d1", "!d2");
}
@@ -204,7 +204,7 @@ public class StandardEnvironmentTests {
System.getProperties().remove(DEFAULT_PROFILES_PROPERTY_NAME);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void defaultProfileWithCircularPlaceholder() {
System.setProperty(DEFAULT_PROFILES_PROPERTY_NAME, "${spring.profiles.default}");
try {
@@ -263,22 +263,22 @@ public class StandardEnvironmentTests {
assertThat(Arrays.asList(environment.getDefaultProfiles()), hasItems("pd2", "pd3"));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void acceptsProfiles_withEmptyArgumentList() {
environment.acceptsProfiles();
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void acceptsProfiles_withNullArgumentList() {
environment.acceptsProfiles((String[])null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void acceptsProfiles_withNullArgument() {
environment.acceptsProfiles((String)null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void acceptsProfiles_withEmptyArgument() {
environment.acceptsProfiles("");
}
@@ -321,7 +321,7 @@ public class StandardEnvironmentTests {
assertThat(environment.acceptsProfiles("!p1"), is(false));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void acceptsProfiles_withInvalidNotOperator() {
environment.acceptsProfiles("p1", "!");
}

View File

@@ -31,7 +31,7 @@ import static org.junit.Assert.*;
* @author Arjen Poutsma
* @author Dave Syer
*/
public final class ResourceEditorTests {
public class ResourceEditorTests {
@Test
public void sunnyDay() throws Exception {
@@ -75,7 +75,7 @@ public final class ResourceEditorTests {
}
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void testStrictSystemPropertyReplacement() {
PropertyEditor editor = new ResourceEditor(new DefaultResourceLoader(), new StandardEnvironment(), false);
System.setProperty("test.prop", "foo");

View File

@@ -239,7 +239,7 @@ public class ResourceTests {
assertThat(resource.contentLength(), is(3L));
}
@Test(expected=IllegalStateException.class)
@Test(expected = IllegalStateException.class)
public void testContentLength_withNullInputStream() throws IOException {
AbstractResource resource = new AbstractResource() {
@Override

View File

@@ -67,7 +67,7 @@ public class ResourceArrayPropertyEditorTests {
}
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void testStrictSystemPropertyReplacement() {
PropertyEditor editor = new ResourceArrayPropertyEditor(
new PathMatchingResourcePatternResolver(), new StandardEnvironment(),

View File

@@ -33,7 +33,7 @@ import static org.junit.Assert.*;
* @author Juergen Hoeller
* @author Sam Brannen
*/
public final class SimpleAsyncTaskExecutorTests {
public class SimpleAsyncTaskExecutorTests {
@Rule
public final ExpectedException exception = ExpectedException.none();

View File

@@ -104,7 +104,7 @@ public class PropertyPlaceholderHelperTests {
assertEquals("foo=bar,bar=${bar}", this.helper.replacePlaceholders(text, props));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void testUnresolvedPlaceholderAsError() {
String text = "foo=${foo},bar=${bar}";
Properties props = new Properties();

View File

@@ -94,7 +94,7 @@ public class SystemPropertyUtilsTests {
assertEquals("Y#{foo.bar}X", resolved);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void testReplaceWithNoDefault() {
String resolved = SystemPropertyUtils.resolvePlaceholders("${test.prop}");
assertEquals("", resolved);

View File

@@ -35,12 +35,12 @@ public class InvertibleComparatorTests {
private Comparator<Integer> comparator = new ComparableComparator<>();
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void shouldNeedComparator() throws Exception {
new InvertibleComparator<>(null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void shouldNeedComparatorWithAscending() throws Exception {
new InvertibleComparator<>(null, true);
}