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); assertThat(metadata.getItems()).hasSize(1);
} }
@SuppressWarnings("removal")
private CandidateComponentsMetadata compile(Class<?>... types) { private CandidateComponentsMetadata compile(Class<?>... types) {
CandidateComponentsIndexer processor = new CandidateComponentsIndexer(); CandidateComponentsIndexer processor = new CandidateComponentsIndexer();
this.compiler.getTask(types).call(processor); this.compiler.getTask(types).call(processor);
return readGeneratedMetadata(this.compiler.getOutputLocation()); return readGeneratedMetadata(this.compiler.getOutputLocation());
} }
@SuppressWarnings("removal")
private CandidateComponentsMetadata compile(String... types) { private CandidateComponentsMetadata compile(String... types) {
CandidateComponentsIndexer processor = new CandidateComponentsIndexer(); CandidateComponentsIndexer processor = new CandidateComponentsIndexer();
this.compiler.getTask(types).call(processor); this.compiler.getTask(types).call(processor);

View File

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

View File

@ -24,6 +24,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
public class QualifierConfiguration { public class QualifierConfiguration {
@SuppressWarnings("unused")
private String bean; private String bean;
@Autowired @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.Enumeration;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.springframework.context.index.CandidateComponentsIndexLoader;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
@ -40,7 +39,7 @@ public class CandidateComponentsTestClassLoader extends ClassLoader {
* if resources are present at the standard location. * if resources are present at the standard location.
* @param classLoader the classloader to use for all other operations * @param classLoader the classloader to use for all other operations
* @return a test {@link ClassLoader} that has no index * @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) { public static ClassLoader disableIndex(ClassLoader classLoader) {
return new CandidateComponentsTestClassLoader(classLoader, return new CandidateComponentsTestClassLoader(classLoader,
@ -87,8 +86,9 @@ public class CandidateComponentsTestClassLoader extends ClassLoader {
} }
@Override @Override
@SuppressWarnings({ "deprecation", "removal" })
public Enumeration<URL> getResources(String name) throws IOException { 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) { if (this.resourceUrls != null) {
return this.resourceUrls; return this.resourceUrls;
} }

View File

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