Suppress warnings, remove unused code, etc.

This commit is contained in:
Sam Brannen
2020-06-20 16:42:36 +02:00
parent 2f0970b184
commit 9d5881e0ad
53 changed files with 418 additions and 449 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -23,7 +23,6 @@ import org.springframework.beans.testfixture.beans.Pet;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ContextLoader;
import org.springframework.test.context.junit4.PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests;
import org.springframework.test.context.support.GenericPropertiesContextLoader;
import static org.assertj.core.api.Assertions.assertThat;
@@ -38,7 +37,8 @@ import static org.assertj.core.api.Assertions.assertThat;
* @see PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests
* @see ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests
*/
@ContextConfiguration(loader = GenericPropertiesContextLoader.class)
@SuppressWarnings("deprecation")
@ContextConfiguration(loader = org.springframework.test.context.support.GenericPropertiesContextLoader.class)
public class ContextConfigurationWithPropertiesExtendingPropertiesTests extends
PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -25,7 +25,6 @@ import org.springframework.test.context.BootstrapWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ContextLoader;
import org.springframework.test.context.support.DefaultTestContextBootstrapper;
import org.springframework.test.context.support.GenericPropertiesContextLoader;
import static org.assertj.core.api.Assertions.assertThat;
@@ -62,8 +61,9 @@ public class CustomDefaultContextLoaderClassSpringRunnerTests {
public static class PropertiesBasedTestContextBootstrapper extends DefaultTestContextBootstrapper {
@Override
@SuppressWarnings("deprecation")
protected Class<? extends ContextLoader> getDefaultContextLoaderClass(Class<?> testClass) {
return GenericPropertiesContextLoader.class;
return org.springframework.test.context.support.GenericPropertiesContextLoader.class;
}
}

View File

@@ -25,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.testfixture.beans.Pet;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.support.GenericPropertiesContextLoader;
import static org.assertj.core.api.Assertions.assertThat;
@@ -51,11 +50,12 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Sam Brannen
* @since 2.5
* @see GenericPropertiesContextLoader
* @see org.springframework.test.context.support.GenericPropertiesContextLoader
* @see SpringJUnit4ClassRunnerAppCtxTests
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(loader = GenericPropertiesContextLoader.class)
@SuppressWarnings("deprecation")
@ContextConfiguration(loader = org.springframework.test.context.support.GenericPropertiesContextLoader.class)
public class PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests {
@Autowired

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -205,14 +205,16 @@ abstract class AbstractContextConfigurationUtilsTests {
static class OverriddenClassesBar extends ClassesFoo {
}
@ContextConfiguration(locations = "/foo.properties", loader = GenericPropertiesContextLoader.class)
@SuppressWarnings("deprecation")
@ContextConfiguration(locations = "/foo.properties", loader = org.springframework.test.context.support.GenericPropertiesContextLoader.class)
@ActiveProfiles("foo")
static class PropertiesLocationsFoo {
}
// Combining @Configuration classes with a Properties based loader doesn't really make
// sense, but that's OK for unit testing purposes.
@ContextConfiguration(classes = FooConfig.class, loader = GenericPropertiesContextLoader.class)
@SuppressWarnings("deprecation")
@ContextConfiguration(classes = FooConfig.class, loader = org.springframework.test.context.support.GenericPropertiesContextLoader.class)
@ActiveProfiles("foo")
static class PropertiesClassesFoo {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -136,9 +136,10 @@ class BootstrapTestUtilsMergedConfigTests extends AbstractContextConfigurationUt
}
@Test
@SuppressWarnings("deprecation")
void buildMergedConfigWithLocalAnnotationAndOverriddenContextLoaderAndLocations() {
Class<?> testClass = PropertiesLocationsFoo.class;
Class<? extends ContextLoader> expectedContextLoaderClass = GenericPropertiesContextLoader.class;
Class<? extends ContextLoader> expectedContextLoaderClass = org.springframework.test.context.support.GenericPropertiesContextLoader.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, array("classpath:/foo.properties"), EMPTY_CLASS_ARRAY,
@@ -146,9 +147,10 @@ class BootstrapTestUtilsMergedConfigTests extends AbstractContextConfigurationUt
}
@Test
@SuppressWarnings("deprecation")
void buildMergedConfigWithLocalAnnotationAndOverriddenContextLoaderAndClasses() {
Class<?> testClass = PropertiesClassesFoo.class;
Class<? extends ContextLoader> expectedContextLoaderClass = GenericPropertiesContextLoader.class;
Class<? extends ContextLoader> expectedContextLoaderClass = org.springframework.test.context.support.GenericPropertiesContextLoader.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, array(FooConfig.class),

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -28,6 +28,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Sam Brannen
* @since 4.0.4
*/
@SuppressWarnings("deprecation")
class GenericPropertiesContextLoaderTests {
private static final String[] EMPTY_STRING_ARRAY = new String[0];