Suppress warnings in tests

This commit is contained in:
Sam Brannen 2023-05-10 14:14:39 +02:00
parent e51c71bcd6
commit 5e52259fb3
5 changed files with 14 additions and 8 deletions

View File

@ -231,12 +231,14 @@ class CandidateComponentsIndexerTests {
assertThat(metadata.getItems()).hasSize(1);
}
@SuppressWarnings("removal")
private CandidateComponentsMetadata compile(Class<?>... types) {
CandidateComponentsIndexer processor = new CandidateComponentsIndexer();
this.compiler.getTask(types).call(processor);
return readGeneratedMetadata(this.compiler.getOutputLocation());
}
@SuppressWarnings("removal")
private CandidateComponentsMetadata compile(String... types) {
CandidateComponentsIndexer processor = new CandidateComponentsIndexer();
this.compiler.getTask(types).call(processor);

View File

@ -61,6 +61,7 @@ class ConcurrentTaskExecutorTests extends AbstractSchedulingTaskExecutorTests {
@Test
void zeroArgCtorResultsInDefaultTaskExecutorBeingUsed() {
@SuppressWarnings("deprecation")
ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor();
assertThatCode(() -> executor.execute(new NoOpRunnable())).doesNotThrowAnyException();
}
@ -73,6 +74,7 @@ class ConcurrentTaskExecutorTests extends AbstractSchedulingTaskExecutorTests {
@Test
void earlySetConcurrentExecutorCallRespectsConfiguredTaskDecorator() {
@SuppressWarnings("deprecation")
ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor();
executor.setConcurrentExecutor(new DecoratedExecutor());
executor.setTaskDecorator(new RunnableDecorator());
@ -81,6 +83,7 @@ class ConcurrentTaskExecutorTests extends AbstractSchedulingTaskExecutorTests {
@Test
void lateSetConcurrentExecutorCallRespectsConfiguredTaskDecorator() {
@SuppressWarnings("deprecation")
ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor();
executor.setTaskDecorator(new RunnableDecorator());
executor.setConcurrentExecutor(new DecoratedExecutor());

View File

@ -24,6 +24,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class QualifierConfiguration {
@SuppressWarnings("unused")
private String bean;
@Autowired
@ -48,4 +49,5 @@ public class QualifierConfiguration {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.stream.Stream;
import org.springframework.context.index.CandidateComponentsIndexLoader;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
@ -40,7 +39,7 @@ public class CandidateComponentsTestClassLoader extends ClassLoader {
* if resources are present at the standard location.
* @param classLoader the classloader to use for all other operations
* @return a test {@link ClassLoader} that has no index
* @see CandidateComponentsIndexLoader#COMPONENTS_RESOURCE_LOCATION
* @see org.springframework.context.index.CandidateComponentsIndexLoader#COMPONENTS_RESOURCE_LOCATION
*/
public static ClassLoader disableIndex(ClassLoader classLoader) {
return new CandidateComponentsTestClassLoader(classLoader,
@ -87,8 +86,9 @@ public class CandidateComponentsTestClassLoader extends ClassLoader {
}
@Override
@SuppressWarnings({ "deprecation", "removal" })
public Enumeration<URL> getResources(String name) throws IOException {
if (CandidateComponentsIndexLoader.COMPONENTS_RESOURCE_LOCATION.equals(name)) {
if (org.springframework.context.index.CandidateComponentsIndexLoader.COMPONENTS_RESOURCE_LOCATION.equals(name)) {
if (this.resourceUrls != null) {
return this.resourceUrls;
}

View File

@ -393,12 +393,11 @@ public class WebMvcConfigurationSupportExtensionTests {
}
@Override
@SuppressWarnings("deprecation")
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setDefaultTimeout(2500).setTaskExecutor(new ConcurrentTaskExecutor())
.registerCallableInterceptors(new CallableProcessingInterceptor() {
})
.registerDeferredResultInterceptors(new DeferredResultProcessingInterceptor() {
});
.registerCallableInterceptors(new CallableProcessingInterceptor() {})
.registerDeferredResultInterceptors(new DeferredResultProcessingInterceptor() {});
}
@Override