Polish "Remove unnecessary throws declaration in tests"
See gh-26441
This commit is contained in:
parent
8a2be288a3
commit
d3c817b7ba
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -65,7 +65,7 @@ class HeapDumpWebEndpointDocumentationTests extends MockMvcEndpointDocumentation
|
|||
return new HeapDumpWebEndpoint() {
|
||||
|
||||
@Override
|
||||
protected HeapDumper createHeapDumper() throws HeapDumperUnavailableException {
|
||||
protected HeapDumper createHeapDumper() {
|
||||
return (file, live) -> FileCopyUtils.copy("<<binary content>>", new FileWriter(file));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -26,7 +26,6 @@ import io.micrometer.core.instrument.composite.CompositeMeterRegistry;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.impl.StaticLoggerBinder;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.atlas.AtlasMetricsExportAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.jmx.JmxMetricsExportAutoConfiguration;
|
||||
|
|
@ -134,7 +133,7 @@ class MeterRegistryConfigurerIntegrationTests {
|
|||
return new BeanPostProcessor() {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof Bravo) {
|
||||
MeterRegistry meterRegistry = context.getBean(MeterRegistry.class);
|
||||
meterRegistry.gauge("test", 1);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
|
|
@ -312,7 +311,7 @@ class DataSourcePoolMetricsAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof HikariDataSource) {
|
||||
try {
|
||||
((HikariDataSource) bean).getConnection().close();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration;
|
||||
|
|
@ -199,7 +198,7 @@ class ReactiveManagementWebSecurityAutoConfigurationTests {
|
|||
static class TestServerHttpSecurity extends ServerHttpSecurity implements ApplicationContextAware {
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
super.setApplicationContext(applicationContext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -21,7 +21,6 @@ import java.util.Map;
|
|||
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory;
|
||||
import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.http.server.reactive.HttpHandler;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
|
@ -72,12 +71,12 @@ class MockReactiveWebServerFactory extends AbstractReactiveWebServerFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
public void start() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws WebServerException {
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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 javax.servlet.ServletContext;
|
|||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter;
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
|
|
@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
public void start() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import org.springframework.boot.actuate.endpoint.ApiVersion;
|
|||
import org.springframework.boot.actuate.endpoint.InvocationContext;
|
||||
import org.springframework.boot.actuate.endpoint.OperationArgumentResolver;
|
||||
import org.springframework.boot.actuate.endpoint.SecurityContext;
|
||||
import org.springframework.boot.actuate.endpoint.invoke.MissingParametersException;
|
||||
import org.springframework.boot.actuate.endpoint.invoke.OperationInvoker;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
@ -221,7 +220,7 @@ class CachingOperationInvokerTests {
|
|||
static AtomicInteger invocations = new AtomicInteger();
|
||||
|
||||
@Override
|
||||
public Mono<String> invoke(InvocationContext context) throws MissingParametersException {
|
||||
public Mono<String> invoke(InvocationContext context) {
|
||||
return Mono.fromCallable(() -> {
|
||||
invocations.incrementAndGet();
|
||||
return "test";
|
||||
|
|
@ -235,7 +234,7 @@ class CachingOperationInvokerTests {
|
|||
static AtomicInteger invocations = new AtomicInteger();
|
||||
|
||||
@Override
|
||||
public Flux<String> invoke(InvocationContext context) throws MissingParametersException {
|
||||
public Flux<String> invoke(InvocationContext context) {
|
||||
return Flux.just("spring", "boot").hide().doFirst(invocations::incrementAndGet);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -32,7 +32,6 @@ import org.junit.jupiter.api.extension.BeforeEachCallback;
|
|||
import org.junit.jupiter.api.extension.Extension;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
|
||||
|
|
@ -161,15 +160,13 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
Class<?> type = parameterContext.getParameter().getType();
|
||||
return type.equals(WebTestClient.class) || type.isAssignableFrom(ConfigurableApplicationContext.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
Class<?> type = parameterContext.getParameter().getType();
|
||||
if (type.equals(WebTestClient.class)) {
|
||||
return createWebTestClient();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -36,7 +36,7 @@ class HeapDumpWebEndpointTests {
|
|||
HeapDumpWebEndpoint slowEndpoint = new HeapDumpWebEndpoint(2500) {
|
||||
|
||||
@Override
|
||||
protected HeapDumper createHeapDumper() throws HeapDumperUnavailableException {
|
||||
protected HeapDumper createHeapDumper() {
|
||||
return (file, live) -> {
|
||||
dumpingLatch.countDown();
|
||||
blockingLatch.await();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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 java.util.Set;
|
|||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
|
|
@ -260,7 +259,7 @@ class AutoConfigurationImportSelectorTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -21,7 +21,6 @@ import java.util.List;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
|
|
@ -106,11 +105,11 @@ class SharedMetadataReaderFactoryContextInitializerTests {
|
|||
static class PostProcessor implements BeanDefinitionRegistryPostProcessor {
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
|
||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
|
||||
for (String name : registry.getBeanDefinitionNames()) {
|
||||
BeanDefinition definition = registry.getBeanDefinition(name);
|
||||
definition.setAttribute("seen", true);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -127,8 +127,7 @@ public class MockCachingProvider implements CachingProvider {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V, C extends Configuration<K, V>> Cache<K, V> createCache(String cacheName, C configuration)
|
||||
throws IllegalArgumentException {
|
||||
public <K, V, C extends Configuration<K, V>> Cache<K, V> createCache(String cacheName, C configuration) {
|
||||
this.configurations.put(cacheName, configuration);
|
||||
Cache<K, V> cache = mock(Cache.class);
|
||||
given(cache.getName()).willReturn(cacheName);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import org.testcontainers.containers.CassandraContainer;
|
|||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
|
|
@ -78,7 +77,7 @@ class CassandraAutoConfigurationIntegrationTests {
|
|||
return new BeanPostProcessor() {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof DriverConfigLoader) {
|
||||
return spy(bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -27,7 +27,6 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|||
import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceResolvable;
|
||||
import org.springframework.context.NoSuchMessageException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
|
@ -223,12 +222,12 @@ class MessageSourceAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
|
||||
public String getMessage(String code, Object[] args, Locale locale) {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
|
||||
public String getMessage(MessageSourceResolvable resolvable, Locale locale) {
|
||||
return resolvable.getCodes()[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.data.redis;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
|
@ -233,7 +232,7 @@ class RedisAutoConfigurationJedisTests {
|
|||
static JedisConnectionFactory connectionFactory;
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof JedisConnectionFactory) {
|
||||
connectionFactory = (JedisConnectionFactory) bean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -24,7 +24,6 @@ import javax.sql.DataSource;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
|
@ -115,7 +114,7 @@ class H2ConsoleAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
@ExtendWith(OutputCaptureExtension.class)
|
||||
void dataSourceUrlIsLoggedWhenAvailable(CapturedOutput output) throws BeansException {
|
||||
void dataSourceUrlIsLoggedWhenAvailable(CapturedOutput output) {
|
||||
this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class))
|
||||
.withPropertyValues("spring.h2.console.enabled=true").run((context) -> {
|
||||
try (Connection connection = context.getBean(DataSource.class).getConnection()) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import javax.sql.DataSource;
|
|||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
|
|
@ -348,7 +347,7 @@ class DataSourceInitializationIntegrationTests {
|
|||
return new BeanPostProcessor() {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof DataSource) {
|
||||
return new DataSourceProxy((DataSource) bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class JndiDataSourceAutoConfigurationTests {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
void mbeanDataSourceIsExcludedFromExport() throws IllegalStateException {
|
||||
void mbeanDataSourceIsExcludedFromExport() {
|
||||
DataSource dataSource = new BasicDataSource();
|
||||
configureJndi("foo", dataSource);
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ class JndiDataSourceAutoConfigurationTests {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
void mbeanDataSourceIsExcludedFromExportByAllExporters() throws IllegalStateException {
|
||||
void mbeanDataSourceIsExcludedFromExportByAllExporters() {
|
||||
DataSource dataSource = new BasicDataSource();
|
||||
configureJndi("foo", dataSource);
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
|
|
@ -127,7 +127,7 @@ class JndiDataSourceAutoConfigurationTests {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
void standardDataSourceIsNotExcludedFromExport() throws IllegalStateException {
|
||||
void standardDataSourceIsNotExcludedFromExport() {
|
||||
DataSource dataSource = mock(DataSource.class);
|
||||
configureJndi("foo", dataSource);
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ class JndiDataSourceAutoConfigurationTests {
|
|||
assertThat(excludedBeans).isEmpty();
|
||||
}
|
||||
|
||||
private void configureJndi(String name, DataSource dataSource) throws IllegalStateException {
|
||||
private void configureJndi(String name, DataSource dataSource) {
|
||||
TestableInitialContextFactory.bind(name, dataSource);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.apache.activemq.ActiveMQConnectionFactory;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.messaginghub.pooled.jms.JmsPoolConnectionFactory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
|
||||
|
|
@ -440,7 +439,7 @@ class JmsAutoConfigurationTests {
|
|||
static class TestConfiguration4 implements BeanPostProcessor {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
if (bean.getClass().isAssignableFrom(JmsTemplate.class)) {
|
||||
JmsTemplate jmsTemplate = (JmsTemplate) bean;
|
||||
jmsTemplate.setPubSubDomain(true);
|
||||
|
|
@ -449,7 +448,7 @@ class JmsAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -238,7 +238,7 @@ class MailSenderAutoConfigurationTests {
|
|||
});
|
||||
}
|
||||
|
||||
private Session configureJndiSession(String name) throws IllegalStateException {
|
||||
private Session configureJndiSession(String name) {
|
||||
Properties properties = new Properties();
|
||||
Session session = Session.getDefaultInstance(properties);
|
||||
TestableInitialContextFactory.bind(name, session);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
|
|
@ -253,7 +252,7 @@ class ReactiveOAuth2ClientAutoConfigurationTests {
|
|||
static class TestServerHttpSecurity extends ServerHttpSecurity implements ApplicationContextAware {
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
super.setApplicationContext(applicationContext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -21,7 +21,6 @@ import java.util.Map;
|
|||
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory;
|
||||
import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.http.server.reactive.HttpHandler;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
|
@ -72,12 +71,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
|
|||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
public void start() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws WebServerException {
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -29,7 +29,6 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
import org.springframework.web.multipart.MultipartException;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.MultipartResolver;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
|
@ -273,7 +272,7 @@ class DispatcherServletAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) throws MultipartException {
|
||||
public MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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 javax.servlet.ServletContext;
|
|||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter;
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
|
|
@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
public void start() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -31,7 +31,6 @@ import org.eclipse.jetty.server.Server;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import reactor.netty.http.server.HttpServer;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
|
|
@ -455,7 +454,7 @@ class ServletWebServerFactoryAutoConfigurationTests {
|
|||
static class EnsureWebServerHasNoServletContext implements BeanPostProcessor {
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof ConfigurableServletWebServerFactory) {
|
||||
MockServletWebServerFactory webServerFactory = (MockServletWebServerFactory) bean;
|
||||
assertThat(webServerFactory.getServletContext()).isNull();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -27,7 +27,6 @@ import javax.sql.DataSource;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
|
|
@ -161,7 +160,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
|
|||
static class DataSourceSpyBeanPostProcessor implements BeanPostProcessor {
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof DataSource) {
|
||||
bean = spy(bean);
|
||||
}
|
||||
|
|
@ -169,7 +168,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -24,7 +24,6 @@ import org.junit.jupiter.api.extension.AfterEachCallback;
|
|||
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
|
|
@ -73,14 +72,12 @@ public class MockRestarter implements BeforeEachCallback, AfterEachCallback, Par
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
return parameterContext.getParameter().getType().equals(Restarter.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
return this.mock;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ChildConfig;
|
||||
import org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ParentConfig;
|
||||
|
|
@ -73,7 +72,7 @@ class MockBeanOnContextHierarchyIntegrationTests {
|
|||
private ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.context = applicationContext;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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 org.junit.jupiter.api.Test;
|
|||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
|
|
@ -309,7 +308,7 @@ class MockitoPostProcessorTests {
|
|||
static class FactoryBeanRegisteringPostProcessor implements BeanFactoryPostProcessor, Ordered {
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
||||
RootBeanDefinition beanDefinition = new RootBeanDefinition(TestFactoryBean.class);
|
||||
((BeanDefinitionRegistry) beanFactory).registerBeanDefinition("test", beanDefinition);
|
||||
}
|
||||
|
|
@ -325,7 +324,7 @@ class MockitoPostProcessorTests {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
||||
Map<String, BeanWrapper> cache = (Map<String, BeanWrapper>) ReflectionTestUtils.getField(beanFactory,
|
||||
"factoryBeanInstanceCache");
|
||||
Assert.isTrue(cache.isEmpty(), "Early initialization of factory bean triggered.");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ChildConfig;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ParentConfig;
|
||||
|
|
@ -74,7 +73,7 @@ class SpyBeanOnContextHierarchyIntegrationTests {
|
|||
private ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.context = applicationContext;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.test.web.client;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
|
|
@ -33,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
class NoTestRestTemplateBeanChecker implements ImportSelector, BeanFactoryAware {
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
assertThat(BeanFactoryUtils.beanNamesForTypeIncludingAncestors((ListableBeanFactory) beanFactory,
|
||||
TestRestTemplate.class)).isEmpty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.test.web.client;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
|
@ -58,7 +57,7 @@ class TestRestTemplateContextCustomizerTests {
|
|||
private final ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
|
||||
@Override
|
||||
protected void refreshBeanFactory() throws BeansException, IllegalStateException {
|
||||
protected void refreshBeanFactory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -67,7 +66,7 @@ class TestRestTemplateContextCustomizerTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException {
|
||||
public ConfigurableListableBeanFactory getBeanFactory() {
|
||||
return this.beanFactory;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class TestRestTemplateTests {
|
|||
ReflectionUtils.doWithMethods(RestOperations.class, new MethodCallback() {
|
||||
|
||||
@Override
|
||||
public void doWith(Method method) throws IllegalArgumentException {
|
||||
public void doWith(Method method) {
|
||||
Method equivalent = ReflectionUtils.findMethod(TestRestTemplate.class, method.getName(),
|
||||
method.getParameterTypes());
|
||||
assertThat(equivalent).as("Method %s not found", method).isNotNull();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.test.web.reactive.server;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
|
|
@ -34,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
class NoWebTestClientBeanChecker implements ImportSelector, BeanFactoryAware {
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
assertThat(BeanFactoryUtils.beanNamesForTypeIncludingAncestors((ListableBeanFactory) beanFactory,
|
||||
WebTestClient.class)).isEmpty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ import java.nio.file.StandardOpenOption;
|
|||
import java.time.Instant;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.gradle.testkit.runner.InvalidRunnerConfigurationException;
|
||||
import org.gradle.testkit.runner.TaskOutcome;
|
||||
import org.gradle.testkit.runner.UnexpectedBuildFailure;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
|
||||
import org.springframework.boot.gradle.junit.GradleCompatibility;
|
||||
|
|
@ -111,8 +109,7 @@ class BuildInfoIntegrationTests {
|
|||
}
|
||||
|
||||
@TestTemplate
|
||||
void reproducibleOutputWithFixedTime()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
||||
void reproducibleOutputWithFixedTime() throws IOException, InterruptedException {
|
||||
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
||||
.isEqualTo(TaskOutcome.SUCCESS);
|
||||
File buildInfoProperties = new File(this.gradleBuild.getProjectDir(), "build/build-info.properties");
|
||||
|
|
|
|||
|
|
@ -46,9 +46,7 @@ import java.util.stream.Stream;
|
|||
import java.util.zip.ZipEntry;
|
||||
|
||||
import org.gradle.testkit.runner.BuildResult;
|
||||
import org.gradle.testkit.runner.InvalidRunnerConfigurationException;
|
||||
import org.gradle.testkit.runner.TaskOutcome;
|
||||
import org.gradle.testkit.runner.UnexpectedBuildFailure;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
|
||||
import org.springframework.boot.gradle.testkit.GradleBuild;
|
||||
|
|
@ -92,8 +90,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
|||
}
|
||||
|
||||
@TestTemplate
|
||||
void reproducibleArchive()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
||||
void reproducibleArchive() throws IOException, InterruptedException {
|
||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||
.isEqualTo(TaskOutcome.SUCCESS);
|
||||
File jar = new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0];
|
||||
|
|
@ -229,8 +226,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
|||
}
|
||||
|
||||
@TestTemplate
|
||||
void upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure {
|
||||
void upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered() {
|
||||
assertThat(this.gradleBuild.scriptProperty("layered", "").build("" + this.taskName).task(":" + this.taskName)
|
||||
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(this.gradleBuild.scriptProperty("layered", "layered {}").build("" + this.taskName)
|
||||
|
|
@ -238,8 +234,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
|||
}
|
||||
|
||||
@TestTemplate
|
||||
void notUpToDateWhenBuiltWithoutLayersAndThenWithLayers()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure {
|
||||
void notUpToDateWhenBuiltWithoutLayersAndThenWithLayers() {
|
||||
assertThat(this.gradleBuild.scriptProperty("layerEnablement", "enabled = false").build(this.taskName)
|
||||
.task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(this.gradleBuild.scriptProperty("layerEnablement", "enabled = true").build(this.taskName)
|
||||
|
|
@ -247,8 +242,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
|||
}
|
||||
|
||||
@TestTemplate
|
||||
void notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure {
|
||||
void notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools() {
|
||||
assertThat(this.gradleBuild.scriptProperty("layerTools", "").build(this.taskName).task(":" + this.taskName)
|
||||
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(this.gradleBuild.scriptProperty("layerTools", "includeLayerTools = false").build(this.taskName)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -27,7 +27,6 @@ import java.util.stream.Stream;
|
|||
import org.junit.jupiter.api.extension.Extension;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
|
||||
|
|
@ -84,14 +83,12 @@ class MavenBuildExtension implements TestTemplateInvocationContextProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
return parameterContext.getParameter().getType().equals(MavenBuild.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
return new MavenBuild(this.mavenHome.toFile());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import org.mockito.InOrder;
|
|||
import org.mockito.Mockito;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.CachedIntrospectionResults;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
|
|
@ -1659,7 +1658,7 @@ class SpringApplicationTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,14 +82,13 @@ class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegra
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Resource> resolve(ConfigDataLocationResolverContext context, ConfigDataLocation location)
|
||||
throws ConfigDataLocationNotFoundException, ConfigDataResourceNotFoundException {
|
||||
public List<Resource> resolve(ConfigDataLocationResolverContext context, ConfigDataLocation location) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Resource> resolveProfileSpecific(ConfigDataLocationResolverContext context,
|
||||
ConfigDataLocation location, Profiles profiles) throws ConfigDataLocationNotFoundException {
|
||||
ConfigDataLocation location, Profiles profiles) {
|
||||
return Collections.singletonList(new Resource(profiles));
|
||||
}
|
||||
|
||||
|
|
@ -98,8 +97,7 @@ class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegra
|
|||
static class Loader implements ConfigDataLoader<Resource> {
|
||||
|
||||
@Override
|
||||
public ConfigData load(ConfigDataLoaderContext context, Resource resource)
|
||||
throws IOException, ConfigDataResourceNotFoundException {
|
||||
public ConfigData load(ConfigDataLoaderContext context, Resource resource) throws IOException {
|
||||
List<PropertySource<?>> propertySources = new ArrayList<>();
|
||||
Map<PropertySource<?>, Options> propertySourceOptions = new HashMap<>();
|
||||
propertySources.add(new MapPropertySource("icwps1", Collections.singletonMap("prop", "fromicwps1")));
|
||||
|
|
|
|||
|
|
@ -179,14 +179,13 @@ class ConfigDataLocationResolversTests {
|
|||
|
||||
@Override
|
||||
public List<TestConfigDataResource> resolve(ConfigDataLocationResolverContext context,
|
||||
ConfigDataLocation location)
|
||||
throws ConfigDataLocationNotFoundException, ConfigDataResourceNotFoundException {
|
||||
ConfigDataLocation location) {
|
||||
return Collections.singletonList(new TestConfigDataResource(this, location, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TestConfigDataResource> resolveProfileSpecific(ConfigDataLocationResolverContext context,
|
||||
ConfigDataLocation location, Profiles profiles) throws ConfigDataLocationNotFoundException {
|
||||
ConfigDataLocation location, Profiles profiles) {
|
||||
return Collections.singletonList(new TestConfigDataResource(this, location, true));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class LoggingApplicationListenerTests {
|
|||
private CapturedOutput output;
|
||||
|
||||
@BeforeEach
|
||||
void init(CapturedOutput output) throws SecurityException, IOException {
|
||||
void init(CapturedOutput output) throws IOException {
|
||||
this.systemPropertyNames = new HashSet<>(System.getProperties().keySet());
|
||||
this.output = output;
|
||||
this.logFile = new File(this.tempDir.toFile(), "foo.log");
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import org.junit.jupiter.api.AfterEach;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
|
@ -382,7 +381,7 @@ class ConfigurationPropertiesTests {
|
|||
this.context = new AnnotationConfigApplicationContext() {
|
||||
|
||||
@Override
|
||||
protected void onRefresh() throws BeansException {
|
||||
protected void onRefresh() {
|
||||
assertThat(WithFactoryBeanConfiguration.factoryBeanInitialized).as("Initialized too early").isFalse();
|
||||
super.onRefresh();
|
||||
}
|
||||
|
|
@ -2298,7 +2297,7 @@ class ConfigurationPropertiesTests {
|
|||
static class PersonPropertyEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
public void setAsText(String text) {
|
||||
String[] content = text.split(",");
|
||||
setValue(new Person(content[1], content[0]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class BindConverterTests {
|
|||
static class SampleTypePropertyEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
public void setAsText(String text) {
|
||||
SampleType value = new SampleType();
|
||||
value.text = text;
|
||||
setValue(value);
|
||||
|
|
@ -238,7 +238,7 @@ class BindConverterTests {
|
|||
static class ConventionTypeEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
public void setAsText(String text) {
|
||||
ConventionType value = new ConventionType();
|
||||
value.text = text;
|
||||
setValue(value);
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ class BinderTests {
|
|||
static class JavaBeanPropertyEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
public void setAsText(String text) {
|
||||
JavaBean value = new JavaBean();
|
||||
value.setValue(text);
|
||||
setValue(value);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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 java.util.Enumeration;
|
|||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
|
|
@ -146,7 +145,7 @@ class FailureAnalyzersTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
failureAnalyzer.setBeanFactory(beanFactory);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -61,7 +61,7 @@ class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||
private Locale defaultLocale;
|
||||
|
||||
@BeforeEach
|
||||
void init() throws SecurityException {
|
||||
void init() {
|
||||
this.logger = Logger.getLogger(getClass().getName());
|
||||
this.defaultLocale = Locale.getDefault();
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.web.reactive.server;
|
|||
import java.util.Map;
|
||||
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.http.server.reactive.HttpHandler;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
|
@ -70,12 +69,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
|
|||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
public void start() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws WebServerException {
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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 javax.servlet.ServletContext;
|
|||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter;
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
|
@ -69,7 +68,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
public void start() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import org.junit.jupiter.api.extension.AfterAllCallback;
|
|||
import org.junit.jupiter.api.extension.Extension;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
|
||||
|
|
@ -150,8 +149,7 @@ class EmbeddedServerContainerInvocationContextProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
if (parameterContext.getParameter().getType().equals(AbstractApplicationLauncher.class)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -162,8 +160,7 @@ class EmbeddedServerContainerInvocationContextProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
if (parameterContext.getParameter().getType().equals(AbstractApplicationLauncher.class)) {
|
||||
return this.launcher;
|
||||
}
|
||||
|
|
@ -181,14 +178,12 @@ class EmbeddedServerContainerInvocationContextProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
return parameterContext.getParameter().getType().equals(RestTemplate.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
RestTemplate rest = new RestTemplate(new HttpComponentsClientHttpRequestFactory(
|
||||
HttpClients.custom().setRetryHandler(new StandardHttpRequestRetryHandler(10, false)).build()));
|
||||
rest.setErrorHandler(new ResponseErrorHandler() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue