Merge pull request #26441 from weixsun

* pr/26441:
  Polish "Remove unnecessary throws declaration in tests"
  Remove unnecessary throws declaration in tests

Closes gh-26441
pull/26586/head
Stephane Nicoll 4 years ago
commit 21a3f03d20

@ -96,7 +96,7 @@ class CloudFoundryActuatorAutoConfigurationTests {
}
@Test
void cloudfoundryapplicationProducesActuatorMediaType() throws Exception {
void cloudfoundryapplicationProducesActuatorMediaType() {
this.contextRunner.withPropertyValues("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id",
"vcap.application.cf_api:https://my-cloud-controller.com").run((context) -> {
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();

@ -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.
@ -91,7 +91,7 @@ class TokenValidatorTests {
}
@Test
void validateTokenWhenKidValidationFailsTwiceShouldThrowException() throws Exception {
void validateTokenWhenKidValidationFailsTwiceShouldThrowException() {
ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys", INVALID_KEYS);
given(this.securityService.fetchTokenKeys()).willReturn(INVALID_KEYS);
String header = "{\"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}";
@ -133,7 +133,7 @@ class TokenValidatorTests {
}
@Test
void validateTokenWhenSignatureInvalidShouldThrowException() throws Exception {
void validateTokenWhenSignatureInvalidShouldThrowException() {
ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys",
Collections.singletonMap("valid-key", INVALID_KEY));
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}";
@ -144,7 +144,7 @@ class TokenValidatorTests {
}
@Test
void validateTokenWhenTokenAlgorithmIsNotRS256ShouldThrowException() throws Exception {
void validateTokenWhenTokenAlgorithmIsNotRS256ShouldThrowException() {
String header = "{ \"alg\": \"HS256\", \"typ\": \"JWT\"}";
String claims = "{ \"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}";
assertThatExceptionOfType(CloudFoundryAuthorizationException.class).isThrownBy(
@ -153,7 +153,7 @@ class TokenValidatorTests {
}
@Test
void validateTokenWhenExpiredShouldThrowException() throws Exception {
void validateTokenWhenExpiredShouldThrowException() {
given(this.securityService.fetchTokenKeys()).willReturn(VALID_KEYS);
given(this.securityService.fetchTokenKeys()).willReturn(VALID_KEYS);
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\", \"typ\": \"JWT\"}";
@ -164,7 +164,7 @@ class TokenValidatorTests {
}
@Test
void validateTokenWhenIssuerIsNotValidShouldThrowException() throws Exception {
void validateTokenWhenIssuerIsNotValidShouldThrowException() {
given(this.securityService.fetchTokenKeys()).willReturn(VALID_KEYS);
given(this.securityService.getUaaUrl()).willReturn("https://other-uaa.com");
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\", \"typ\": \"JWT\", \"scope\": [\"actuator.read\"]}";
@ -175,7 +175,7 @@ class TokenValidatorTests {
}
@Test
void validateTokenWhenAudienceIsNotValidShouldThrowException() throws Exception {
void validateTokenWhenAudienceIsNotValidShouldThrowException() {
given(this.securityService.fetchTokenKeys()).willReturn(VALID_KEYS);
given(this.securityService.getUaaUrl()).willReturn("http://localhost:8080/uaa");
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\", \"typ\": \"JWT\"}";

@ -183,14 +183,14 @@ class ConditionalOnAvailableEndpointTests {
}
@Test // gh-21044
void outcomeWhenIncludeAllShouldMatchDashedEndpoint() throws Exception {
void outcomeWhenIncludeAllShouldMatchDashedEndpoint() {
this.contextRunner.withUserConfiguration(DashedEndpointConfiguration.class)
.withPropertyValues("management.endpoints.web.exposure.include=*")
.run((context) -> assertThat(context).hasSingleBean(DashedEndpoint.class));
}
@Test // gh-21044
void outcomeWhenIncludeDashedShouldMatchDashedEndpoint() throws Exception {
void outcomeWhenIncludeDashedShouldMatchDashedEndpoint() {
this.contextRunner.withUserConfiguration(DashedEndpointConfiguration.class)
.withPropertyValues("management.endpoints.web.exposure.include=test-dashed")
.run((context) -> assertThat(context).hasSingleBean(DashedEndpoint.class));

@ -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.
@ -145,7 +145,7 @@ class IncludeExcludeEndpointFilterTests {
}
@Test // gh-20997
void matchWhenDashInName() throws Exception {
void matchWhenDashInName() {
setupFilter("bus-refresh", "");
assertThat(match(EndpointId.of("bus-refresh"))).isTrue();
}

@ -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-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.
@ -77,7 +77,7 @@ class MappingsEndpointReactiveDocumentationTests extends AbstractEndpointDocumen
}
@Test
void mappings() throws Exception {
void mappings() {
List<FieldDescriptor> requestMappingConditions = Arrays.asList(
requestMappingConditionField("").description("Details of the request mapping conditions.").optional(),
requestMappingConditionField(".consumes").description("Details of the consumes condition"),

@ -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.
@ -76,7 +76,7 @@ class MappingsEndpointServletDocumentationTests extends AbstractEndpointDocument
}
@Test
void mappings() throws Exception {
void mappings() {
ResponseFieldsSnippet commonResponseFields = responseFields(
fieldWithPath("contexts").description("Application contexts keyed by id."),
fieldWithPath("contexts.*.mappings").description("Mappings in the context, keyed by mapping type."),

@ -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.
@ -56,7 +56,7 @@ class ControllerEndpointWebFluxIntegrationTests {
}
@Test
void endpointsCanBeAccessed() throws Exception {
void endpointsCanBeAccessed() {
TestSecurityContextHolder.getContext()
.setAuthentication(new TestingAuthenticationToken("user", "N/A", "ROLE_ACTUATOR"));
this.context = new AnnotationConfigReactiveWebApplicationContext();

@ -51,7 +51,7 @@ class WebFluxEndpointIntegrationTests {
.withUserConfiguration(EndpointsConfiguration.class);
@Test
void linksAreProvidedToAllEndpointTypes() throws Exception {
void linksAreProvidedToAllEndpointTypes() {
this.contextRunner.withPropertyValues("management.endpoints.web.exposure.include:*").run((context) -> {
WebTestClient client = createWebTestClient(context);
client.get().uri("/actuator").exchange().expectStatus().isOk().expectBody().jsonPath("_links.beans")
@ -61,7 +61,7 @@ class WebFluxEndpointIntegrationTests {
}
@Test
void linksPageIsNotAvailableWhenDisabled() throws Exception {
void linksPageIsNotAvailableWhenDisabled() {
this.contextRunner.withPropertyValues("management.endpoints.web.discovery.enabled=false").run((context) -> {
WebTestClient client = createWebTestClient(context);
client.get().uri("/actuator").exchange().expectStatus().isNotFound();

@ -171,7 +171,7 @@ class WebMvcEndpointExposureIntegrationTests {
.build();
}
private boolean isExposed(WebTestClient client, HttpMethod method, String path) throws Exception {
private boolean isExposed(WebTestClient client, HttpMethod method, String path) {
path = "/actuator/" + path;
EntityExchangeResult<byte[]> result = client.method(method).uri(path).exchange().expectBody().returnResult();
if (result.getStatus() == HttpStatus.OK) {

@ -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;
@ -159,7 +158,7 @@ class ReactiveManagementWebSecurityAutoConfigurationTests {
static class CustomSecurityConfiguration {
@Bean
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) throws Exception {
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange((exchanges) -> {
exchanges.pathMatchers("/foo").permitAll();
exchanges.anyExchange().authenticated();
@ -179,7 +178,7 @@ class ReactiveManagementWebSecurityAutoConfigurationTests {
}
@Bean
WebFilterChainProxy webFilterChainProxy(ServerHttpSecurity http) throws Exception {
WebFilterChainProxy webFilterChainProxy(ServerHttpSecurity http) {
return new WebFilterChainProxy(getFilterChains(http));
}
@ -190,7 +189,7 @@ class ReactiveManagementWebSecurityAutoConfigurationTests {
return httpSecurity;
}
private List<SecurityWebFilterChain> getFilterChains(ServerHttpSecurity http) throws Exception {
private List<SecurityWebFilterChain> getFilterChains(ServerHttpSecurity http) {
http.authorizeExchange((exchanges) -> exchanges.anyExchange().authenticated());
http.formLogin(Customizer.withDefaults());
return Collections.singletonList(http.build());
@ -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-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.
@ -22,7 +22,6 @@ import java.net.URLClassLoader;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.ReflectionException;
@ -87,7 +86,7 @@ class EndpointMBeanTests {
}
@Test
void invokeWhenOperationFailedShouldTranslateException() throws MBeanException, ReflectionException {
void invokeWhenOperationFailedShouldTranslateException() {
TestExposableJmxEndpoint endpoint = new TestExposableJmxEndpoint(new TestJmxOperation((arguments) -> {
throw new FatalBeanException("test failure");
}));
@ -99,7 +98,7 @@ class EndpointMBeanTests {
}
@Test
void invokeWhenOperationFailedWithJdkExceptionShouldReuseException() throws MBeanException, ReflectionException {
void invokeWhenOperationFailedWithJdkExceptionShouldReuseException() {
TestExposableJmxEndpoint endpoint = new TestExposableJmxEndpoint(new TestJmxOperation((arguments) -> {
throw new UnsupportedOperationException("test failure");
}));
@ -110,7 +109,7 @@ class EndpointMBeanTests {
}
@Test
void invokeWhenActionNameIsNotAnOperationShouldThrowException() throws MBeanException, ReflectionException {
void invokeWhenActionNameIsNotAnOperationShouldThrowException() {
EndpointMBean bean = createEndpointMBean();
assertThatExceptionOfType(ReflectionException.class)
.isThrownBy(() -> bean.invoke("missingOperation", NO_PARAMS, NO_SIGNATURE))
@ -131,7 +130,7 @@ class EndpointMBeanTests {
}
@Test
void invokeWhenOperationIsInvalidShouldThrowException() throws MBeanException, ReflectionException {
void invokeWhenOperationIsInvalidShouldThrowException() {
TestJmxOperation operation = new TestJmxOperation() {
@Override
@ -166,15 +165,14 @@ class EndpointMBeanTests {
}
@Test
void getAttributeShouldThrowException() throws AttributeNotFoundException, MBeanException, ReflectionException {
void getAttributeShouldThrowException() {
EndpointMBean bean = createEndpointMBean();
assertThatExceptionOfType(AttributeNotFoundException.class).isThrownBy(() -> bean.getAttribute("test"))
.withMessageContaining("EndpointMBeans do not support attributes");
}
@Test
void setAttributeShouldThrowException()
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
void setAttributeShouldThrowException() {
EndpointMBean bean = createEndpointMBean();
assertThatExceptionOfType(AttributeNotFoundException.class)
.isThrownBy(() -> bean.setAttribute(new Attribute("test", "test")))

@ -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.
@ -51,7 +51,7 @@ class ControllerEndpointHandlerMappingTests {
private final StaticApplicationContext context = new StaticApplicationContext();
@Test
void mappingWithNoPrefix() throws Exception {
void mappingWithNoPrefix() {
ExposableControllerEndpoint first = firstEndpoint();
ExposableControllerEndpoint second = secondEndpoint();
ControllerEndpointHandlerMapping mapping = createMapping("", first, second);
@ -62,7 +62,7 @@ class ControllerEndpointHandlerMappingTests {
}
@Test
void mappingWithPrefix() throws Exception {
void mappingWithPrefix() {
ExposableControllerEndpoint first = firstEndpoint();
ExposableControllerEndpoint second = secondEndpoint();
ControllerEndpointHandlerMapping mapping = createMapping("actuator", first, second);
@ -75,7 +75,7 @@ class ControllerEndpointHandlerMappingTests {
}
@Test
void mappingWithNoPath() throws Exception {
void mappingWithNoPath() {
ExposableControllerEndpoint pathless = pathlessEndpoint();
ControllerEndpointHandlerMapping mapping = createMapping("actuator", pathless);
assertThat(getHandler(mapping, HttpMethod.GET, "/actuator/pathless"))
@ -85,7 +85,7 @@ class ControllerEndpointHandlerMappingTests {
}
@Test
void mappingNarrowedToMethod() throws Exception {
void mappingNarrowedToMethod() {
ExposableControllerEndpoint first = firstEndpoint();
ControllerEndpointHandlerMapping mapping = createMapping("actuator", first);
assertThatExceptionOfType(MethodNotAllowedException.class)

@ -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.
@ -73,7 +73,7 @@ class ControllerEndpointHandlerMappingTests {
}
@Test
void mappingNarrowedToMethod() throws Exception {
void mappingNarrowedToMethod() {
ExposableControllerEndpoint first = firstEndpoint();
ControllerEndpointHandlerMapping mapping = createMapping("actuator", first);
assertThatExceptionOfType(HttpRequestMethodNotSupportedException.class)

@ -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-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.
@ -227,7 +227,7 @@ class EnvironmentEndpointTests {
}
@Test
void propertyWithCharSequenceTypeIsConvertedToString() throws Exception {
void propertyWithCharSequenceTypeIsConvertedToString() {
ConfigurableEnvironment environment = emptyEnvironment();
environment.getPropertySources().addFirst(singleKeyPropertySource("test", "foo", new CharSequenceProperty()));
EnvironmentDescriptor descriptor = new EnvironmentEndpoint(environment).environment(null);

@ -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.
@ -50,7 +50,7 @@ class LogFileWebEndpointWebIntegrationTests {
}
@BeforeAll
static void setup(@TempDir File temp) throws IOException {
static void setup(@TempDir File temp) {
tempFile = temp;
}

@ -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-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.
@ -59,13 +59,13 @@ class HeapDumpWebEndpointWebIntegrationTests {
}
@WebEndpointTest
void getRequestShouldReturnHeapDumpInResponseBody(WebTestClient client) throws Exception {
void getRequestShouldReturnHeapDumpInResponseBody(WebTestClient client) {
client.get().uri("/actuator/heapdump").exchange().expectStatus().isOk().expectHeader()
.contentType(MediaType.APPLICATION_OCTET_STREAM).expectBody(String.class).isEqualTo("HEAPDUMP");
assertHeapDumpFileIsDeleted();
}
private void assertHeapDumpFileIsDeleted() throws InterruptedException {
private void assertHeapDumpFileIsDeleted() {
Awaitility.waitAtMost(Duration.ofSeconds(5)).until(this.endpoint.file::exists, is(false));
}

@ -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.
@ -33,13 +33,13 @@ import static org.assertj.core.api.Assertions.assertThat;
class ThreadDumpEndpointWebIntegrationTests {
@WebEndpointTest
void getRequestWithJsonAcceptHeaderShouldProduceJsonThreadDumpResponse(WebTestClient client) throws Exception {
void getRequestWithJsonAcceptHeaderShouldProduceJsonThreadDumpResponse(WebTestClient client) {
client.get().uri("/actuator/threaddump").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
.expectHeader().contentType(MediaType.APPLICATION_JSON);
}
@WebEndpointTest
void getRequestWithTextPlainAcceptHeaderShouldProduceTextPlainResponse(WebTestClient client) throws Exception {
void getRequestWithTextPlainAcceptHeaderShouldProduceTextPlainResponse(WebTestClient client) {
String response = client.get().uri("/actuator/threaddump").accept(MediaType.TEXT_PLAIN).exchange()
.expectStatus().isOk().expectHeader().contentType("text/plain;charset=UTF-8").expectBody(String.class)
.returnResult().getResponseBody();

@ -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.
@ -85,7 +85,7 @@ class WebMvcMetricsIntegrationTests {
}
@Test
void rethrownExceptionIsRecordedInMetricTag() throws Exception {
void rethrownExceptionIsRecordedInMetricTag() {
assertThatExceptionOfType(NestedServletException.class)
.isThrownBy(() -> this.mvc.perform(get("/api/rethrownError")).andReturn());
assertThat(this.registry.get("http.server.requests").tags("exception", "Exception2", "status", "500").timer()

@ -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.
@ -99,7 +99,7 @@ class HttpTraceFilterTests {
}
@Test
void statusIsAssumedToBe500WhenChainFails() throws ServletException, IOException {
void statusIsAssumedToBe500WhenChainFails() {
assertThatIOException().isThrownBy(() -> this.filter.doFilter(new MockHttpServletRequest(),
new MockHttpServletResponse(), new MockFilterChain(new HttpServlet() {

@ -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);

@ -722,7 +722,7 @@ class RabbitAutoConfigurationTests {
}
@Test
void enableSslWithValidateServerCertificateFalse() throws Exception {
void enableSslWithValidateServerCertificateFalse() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
"spring.rabbitmq.ssl.validateServerCertificate=false")
@ -734,7 +734,7 @@ class RabbitAutoConfigurationTests {
}
@Test
void enableSslWithValidateServerCertificateDefault() throws Exception {
void enableSslWithValidateServerCertificateDefault() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.ssl.enabled:true").run((context) -> {
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context);
@ -785,43 +785,42 @@ class RabbitAutoConfigurationTests {
}
@Test
void whenACredentialsProviderIsAvailableThenConnectionFactoryIsConfiguredToUseIt() throws Exception {
void whenACredentialsProviderIsAvailableThenConnectionFactoryIsConfiguredToUseIt() {
this.contextRunner.withUserConfiguration(CredentialsProviderConfiguration.class)
.run((context) -> assertThat(getTargetConnectionFactory(context).params(null).getCredentialsProvider())
.isEqualTo(CredentialsProviderConfiguration.credentialsProvider));
}
@Test
void whenAPrimaryCredentialsProviderIsAvailableThenConnectionFactoryIsConfiguredToUseIt() throws Exception {
void whenAPrimaryCredentialsProviderIsAvailableThenConnectionFactoryIsConfiguredToUseIt() {
this.contextRunner.withUserConfiguration(PrimaryCredentialsProviderConfiguration.class)
.run((context) -> assertThat(getTargetConnectionFactory(context).params(null).getCredentialsProvider())
.isEqualTo(PrimaryCredentialsProviderConfiguration.credentialsProvider));
}
@Test
void whenMultipleCredentialsProvidersAreAvailableThenConnectionFactoryUsesDefaultProvider() throws Exception {
void whenMultipleCredentialsProvidersAreAvailableThenConnectionFactoryUsesDefaultProvider() {
this.contextRunner.withUserConfiguration(MultipleCredentialsProvidersConfiguration.class)
.run((context) -> assertThat(getTargetConnectionFactory(context).params(null).getCredentialsProvider())
.isInstanceOf(DefaultCredentialsProvider.class));
}
@Test
void whenACredentialsRefreshServiceIsAvailableThenConnectionFactoryIsConfiguredToUseIt() throws Exception {
void whenACredentialsRefreshServiceIsAvailableThenConnectionFactoryIsConfiguredToUseIt() {
this.contextRunner.withUserConfiguration(CredentialsRefreshServiceConfiguration.class).run(
(context) -> assertThat(getTargetConnectionFactory(context).params(null).getCredentialsRefreshService())
.isEqualTo(CredentialsRefreshServiceConfiguration.credentialsRefreshService));
}
@Test
void whenAPrimaryCredentialsRefreshServiceIsAvailableThenConnectionFactoryIsConfiguredToUseIt() throws Exception {
void whenAPrimaryCredentialsRefreshServiceIsAvailableThenConnectionFactoryIsConfiguredToUseIt() {
this.contextRunner.withUserConfiguration(PrimaryCredentialsRefreshServiceConfiguration.class).run(
(context) -> assertThat(getTargetConnectionFactory(context).params(null).getCredentialsRefreshService())
.isEqualTo(PrimaryCredentialsRefreshServiceConfiguration.credentialsRefreshService));
}
@Test
void whenMultipleCredentialsRefreshServiceAreAvailableThenConnectionFactoryHasNoCredentialsRefreshService()
throws Exception {
void whenMultipleCredentialsRefreshServiceAreAvailableThenConnectionFactoryHasNoCredentialsRefreshService() {
this.contextRunner.withUserConfiguration(MultipleCredentialsRefreshServicesConfiguration.class).run(
(context) -> assertThat(getTargetConnectionFactory(context).params(null).getCredentialsRefreshService())
.isNull());

@ -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.
@ -60,22 +60,22 @@ class BatchAutoConfigurationWithoutJdbcTests {
static class BatchConfiguration implements BatchConfigurer {
@Override
public JobRepository getJobRepository() throws Exception {
public JobRepository getJobRepository() {
return mock(JobRepository.class);
}
@Override
public PlatformTransactionManager getTransactionManager() throws Exception {
public PlatformTransactionManager getTransactionManager() {
return mock(PlatformTransactionManager.class);
}
@Override
public JobLauncher getJobLauncher() throws Exception {
public JobLauncher getJobLauncher() {
return mock(JobLauncher.class);
}
@Override
public JobExplorer getJobExplorer() throws Exception {
public JobExplorer getJobExplorer() {
return mock(JobExplorer.class);
}

@ -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);
}

@ -79,7 +79,7 @@ class DataSourcePropertiesTests {
}
@Test
void whenEmbeddedConnectionIsNoneAndNoUrlIsConfiguredThenDetermineUrlThrows() throws Exception {
void whenEmbeddedConnectionIsNoneAndNoUrlIsConfiguredThenDetermineUrlThrows() {
DataSourceProperties properties = new DataSourceProperties();
properties.setGenerateUniqueName(false);
properties.setEmbeddedDatabaseConnection(EmbeddedDatabaseConnection.NONE);

@ -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.autoconfigure.jdbc;
import java.util.Set;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
@ -80,7 +79,7 @@ class JndiDataSourceAutoConfigurationTests {
}
@Test
void dataSourceIsAvailableFromJndi() throws IllegalStateException, NamingException {
void dataSourceIsAvailableFromJndi() {
DataSource dataSource = new BasicDataSource();
configureJndi("foo", dataSource);
@ -94,7 +93,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings("unchecked")
@Test
void mbeanDataSourceIsExcludedFromExport() throws IllegalStateException, NamingException {
void mbeanDataSourceIsExcludedFromExport() {
DataSource dataSource = new BasicDataSource();
configureJndi("foo", dataSource);
@ -111,7 +110,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings("unchecked")
@Test
void mbeanDataSourceIsExcludedFromExportByAllExporters() throws IllegalStateException, NamingException {
void mbeanDataSourceIsExcludedFromExportByAllExporters() {
DataSource dataSource = new BasicDataSource();
configureJndi("foo", dataSource);
this.context = new AnnotationConfigApplicationContext();
@ -128,7 +127,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings("unchecked")
@Test
void standardDataSourceIsNotExcludedFromExport() throws IllegalStateException, NamingException {
void standardDataSourceIsNotExcludedFromExport() {
DataSource dataSource = mock(DataSource.class);
configureJndi("foo", dataSource);
@ -143,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.
@ -35,7 +35,7 @@ public class TestableInitialContextFactory implements InitialContextFactory {
private static TestableContext context;
@Override
public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
public Context getInitialContext(Hashtable<?, ?> environment) {
return getContext();
}
@ -78,7 +78,7 @@ public class TestableInitialContextFactory implements InitialContextFactory {
}
@Override
public Object lookup(String name) throws NamingException {
public Object lookup(String name) {
return this.bindings.get(name);
}

@ -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);

@ -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.
@ -17,7 +17,6 @@
package org.springframework.boot.autoconfigure.mongo.embedded;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.EnumSet;
import java.util.Map;
@ -150,7 +149,7 @@ class EmbeddedMongoAutoConfigurationTests {
}
@Test
void mongoWritesToCustomDatabaseDir(@TempDir Path temp) throws IOException {
void mongoWritesToCustomDatabaseDir(@TempDir Path temp) {
File customDatabaseDir = new File(temp.toFile(), "custom-database-dir");
FileSystemUtils.deleteRecursively(customDatabaseDir);
load("spring.mongodb.embedded.storage.databaseDir=" + customDatabaseDir.getPath());

@ -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.
@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class RSocketWebSocketNettyRouteProviderTests {
@Test
void webEndpointsShouldWork() throws Exception {
void webEndpointsShouldWork() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new)
.withConfiguration(
AutoConfigurations.of(HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class,

@ -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);
}

@ -469,7 +469,7 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
static class SecurityWebFilterChainConfig {
@Bean
SecurityWebFilterChain testSpringSecurityFilterChain(ServerHttpSecurity http) throws Exception {
SecurityWebFilterChain testSpringSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange((exchanges) -> {
exchanges.pathMatchers("/message/**").hasRole("ADMIN");
exchanges.anyExchange().authenticated();

@ -17,7 +17,6 @@
package org.springframework.boot.autoconfigure.transaction.jta;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import javax.jms.ConnectionFactory;
@ -115,7 +114,7 @@ class JtaAutoConfigurationTests {
}
@Test
void defaultAtomikosTransactionManagerName(@TempDir Path dir) throws IOException {
void defaultAtomikosTransactionManagerName(@TempDir Path dir) {
this.context = new AnnotationConfigApplicationContext();
File logs = new File(dir.toFile(), "jta");
TestPropertyValues.of("spring.jta.logDir:" + logs.getAbsolutePath()).applyTo(this.context);

@ -433,7 +433,7 @@ class ServerPropertiesTests {
}
@Test
void jettyMaxHttpFormPostSizeMatchesDefault() throws Exception {
void jettyMaxHttpFormPostSizeMatchesDefault() {
JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0);
JettyWebServer jetty = (JettyWebServer) jettyFactory
.getWebServer((ServletContextInitializer) (servletContext) -> servletContext
@ -527,7 +527,7 @@ class ServerPropertiesTests {
.isEqualTo(HttpDecoderSpec.DEFAULT_INITIAL_BUFFER_SIZE);
}
private Connector getDefaultConnector() throws Exception {
private Connector getDefaultConnector() {
return new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);
}

@ -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.
@ -98,7 +98,7 @@ class ServletWebServerFactoryCustomizerTests {
}
@Test
void customizeSessionProperties() throws Exception {
void customizeSessionProperties() {
Map<String, String> map = new HashMap<>();
map.put("server.servlet.session.timeout", "123");
map.put("server.servlet.session.tracking-modes", "cookie,url");

@ -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.
@ -98,7 +98,7 @@ class BasicErrorControllerDirectMockMvcTests {
}
@Test
void errorPageNotAvailableWithWhitelabelDisabled() throws Exception {
void errorPageNotAvailableWithWhitelabelDisabled() {
setup((ConfigurableWebApplicationContext) new SpringApplication(WebMvcIncludedConfiguration.class)
.run("--server.port=0", "--server.error.whitelabel.enabled=false"));
assertThatExceptionOfType(ServletException.class)

@ -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.
@ -180,7 +180,7 @@ class BasicErrorControllerMockMvcTests {
}
@RequestMapping("/noContent")
void noContent() throws Exception {
void noContent() {
throw new NoContentException("Expected!");
}

@ -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.
@ -69,7 +69,7 @@ class ErrorMvcAutoConfigurationTests {
}
@Test
void renderCanUseJavaTimeTypeAsTimestamp() throws Exception { // gh-23256
void renderCanUseJavaTimeTypeAsTimestamp() { // gh-23256
this.contextRunner.run((context) -> {
View errorView = context.getBean("error", View.class);
ErrorAttributes errorAttributes = context.getBean(ErrorAttributes.class);

@ -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.
@ -64,7 +64,7 @@ class ReproIntegrationTests {
}
@Test
void jarFileExtensionNeeded() throws Exception {
void jarFileExtensionNeeded() {
assertThatExceptionOfType(ExecutionException.class)
.isThrownBy(() -> this.cli.jar("secure.groovy", "data-jpa.groovy"))
.withMessageContaining("is not a JAR 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.
@ -94,7 +94,7 @@ class CommandRunnerTests {
}
@Test
void runWithoutArguments() throws Exception {
void runWithoutArguments() {
assertThatExceptionOfType(NoArgumentsException.class).isThrownBy(this.commandRunner::run);
}
@ -105,7 +105,7 @@ class CommandRunnerTests {
}
@Test
void missingCommand() throws Exception {
void missingCommand() {
assertThatExceptionOfType(NoSuchCommandException.class).isThrownBy(() -> this.commandRunner.run("missing"));
}
@ -170,13 +170,13 @@ class CommandRunnerTests {
}
@Test
void helpNoCommand() throws Exception {
void helpNoCommand() {
assertThatExceptionOfType(NoHelpCommandArgumentsException.class)
.isThrownBy(() -> this.commandRunner.run("help"));
}
@Test
void helpUnknownCommand() throws Exception {
void helpUnknownCommand() {
assertThatExceptionOfType(NoSuchCommandException.class)
.isThrownBy(() -> this.commandRunner.run("help", "missing"));
}

@ -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.
@ -199,7 +199,7 @@ class ProjectGenerationRequestTests {
}
@Test
void noTypeAndNoDefault() throws Exception {
void noTypeAndNoDefault() {
assertThatExceptionOfType(ReportableException.class)
.isThrownBy(() -> this.request.generateUrl(readMetadata("types-conflict")))
.withMessageContaining("no default is defined");

@ -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.
@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock;
class SpringApplicationRunnerTests {
@Test
void exceptionMessageWhenSourcesContainsNoClasses() throws Exception {
void exceptionMessageWhenSourcesContainsNoClasses() {
SpringApplicationRunnerConfiguration configuration = mock(SpringApplicationRunnerConfiguration.class);
given(configuration.getClasspath()).willReturn(new String[] { "foo", "bar" });
given(configuration.getLogLevel()).willReturn(Level.INFO);

@ -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.
@ -16,8 +16,6 @@
package org.springframework.boot.devtools.tests;
import java.io.IOException;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
@ -49,7 +47,7 @@ class DevToolsWithLazyInitializationIntegrationTests extends AbstractDevToolsInt
assertThat(template.getForObject(urlBase + "/two", String.class)).isEqualTo("two");
}
static Object[] parameters() throws IOException {
static Object[] parameters() {
Directories directories = new Directories(buildOutput, temp);
return new Object[] { new Object[] { new LocalApplicationLauncher(directories) },
new Object[] { new ExplodedRemoteApplicationLauncher(directories) },

@ -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.
@ -100,13 +100,13 @@ abstract class RemoteApplicationLauncher extends AbstractApplicationLauncher {
return StringUtils.collectionToDelimitedString(entries, File.pathSeparator);
}
private int awaitServerPort(LaunchedJvm jvm, File serverPortFile) throws Exception {
private int awaitServerPort(LaunchedJvm jvm, File serverPortFile) {
return Awaitility.waitAtMost(Duration.ofMinutes(3))
.until(() -> new ApplicationState(serverPortFile, jvm), ApplicationState::hasServerPort)
.getServerPort();
}
private void awaitRemoteSpringApplication(LaunchedJvm launchedJvm) throws Exception {
private void awaitRemoteSpringApplication(LaunchedJvm launchedJvm) {
FileContents contents = new FileContents(launchedJvm.getStandardOut());
try {
Awaitility.waitAtMost(Duration.ofMinutes(3)).until(contents::get,

@ -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.
@ -17,7 +17,6 @@
package org.springframework.boot.devtools.autoconfigure;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.Duration;
@ -52,7 +51,7 @@ import static org.mockito.Mockito.verify;
class DevToolsPooledDataSourceAutoConfigurationTests extends AbstractDevToolsDataSourceAutoConfigurationTests {
@BeforeEach
void before(@TempDir File tempDir) throws IOException {
void before(@TempDir File tempDir) {
System.setProperty("derby.stream.error.file", new File(tempDir, "derby.log").getAbsolutePath());
}

@ -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.
@ -37,42 +37,42 @@ class ChangedFileTests {
File tempDir;
@Test
void sourceDirectoryMustNotBeNull() throws Exception {
void sourceDirectoryMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ChangedFile(null, new File(this.tempDir, "file"), Type.ADD))
.withMessageContaining("SourceDirectory must not be null");
}
@Test
void fileMustNotBeNull() throws Exception {
void fileMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ChangedFile(new File(this.tempDir, "directory"), null, Type.ADD))
.withMessageContaining("File must not be null");
}
@Test
void typeMustNotBeNull() throws Exception {
void typeMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(
() -> new ChangedFile(new File(this.tempDir, "file"), new File(this.tempDir, "directory"), null))
.withMessageContaining("Type must not be null");
}
@Test
void getFile() throws Exception {
void getFile() {
File file = new File(this.tempDir, "file");
ChangedFile changedFile = new ChangedFile(new File(this.tempDir, "directory"), file, Type.ADD);
assertThat(changedFile.getFile()).isEqualTo(file);
}
@Test
void getType() throws Exception {
void getType() {
ChangedFile changedFile = new ChangedFile(new File(this.tempDir, "directory"), new File(this.tempDir, "file"),
Type.DELETE);
assertThat(changedFile.getType()).isEqualTo(Type.DELETE);
}
@Test
void getRelativeName() throws Exception {
void getRelativeName() {
File subDirectory = new File(this.tempDir, "A");
File file = new File(subDirectory, "B.txt");
ChangedFile changedFile = new ChangedFile(this.tempDir, file, Type.ADD);

@ -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.
@ -65,7 +65,7 @@ class DirectorySnapshotTests {
}
@Test
void directoryDoesNotHaveToExist() throws Exception {
void directoryDoesNotHaveToExist() {
File file = new File(this.tempDir, "does/not/exist");
DirectorySnapshot snapshot = new DirectorySnapshot(file);
assertThat(snapshot).isEqualTo(new DirectorySnapshot(file));
@ -107,7 +107,7 @@ class DirectorySnapshotTests {
}
@Test
void getChangedFilesSnapshotMustBeTheSameSourceDirectory() throws Exception {
void getChangedFilesSnapshotMustBeTheSameSourceDirectory() {
assertThatIllegalArgumentException().isThrownBy(
() -> this.initialSnapshot.getChangedFiles(new DirectorySnapshot(createTestDirectoryStructure()), null))
.withMessageContaining("Snapshot source directory must be '" + this.directory + "'");

@ -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.
@ -51,7 +51,7 @@ class FileSnapshotTests {
}
@Test
void fileMustNotBeADirectory() throws Exception {
void fileMustNotBeADirectory() {
File file = new File(this.tempDir, "file");
file.mkdir();
assertThatIllegalArgumentException().isThrownBy(() -> new FileSnapshot(file))

@ -110,7 +110,7 @@ class FileSystemWatcherTests {
}
@Test
void cannotAddSourceDirectoryToStartedListener() throws Exception {
void cannotAddSourceDirectoryToStartedListener() {
this.watcher.start();
assertThatIllegalStateException().isThrownBy(() -> this.watcher.addSourceDirectory(this.tempDir))
.withMessageContaining("FileSystemWatcher already started");
@ -300,7 +300,7 @@ class FileSystemWatcherTests {
this.watcher.addListener((changeSet) -> FileSystemWatcherTests.this.changes.add(changeSet));
}
private File startWithNewDirectory() throws IOException {
private File startWithNewDirectory() {
File directory = new File(this.tempDir, UUID.randomUUID().toString());
directory.mkdir();
this.watcher.addSourceDirectory(directory);

@ -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.
@ -58,13 +58,13 @@ class ConnectionInputStreamTests {
}
@Test
void checkedRead() throws Exception {
void checkedRead() {
ConnectionInputStream inputStream = new ConnectionInputStream(new ByteArrayInputStream(NO_BYTES));
assertThatIOException().isThrownBy(inputStream::checkedRead).withMessageContaining("End of stream");
}
@Test
void checkedReadArray() throws Exception {
void checkedReadArray() {
byte[] buffer = new byte[100];
ConnectionInputStream inputStream = new ConnectionInputStream(new ByteArrayInputStream(NO_BYTES));
assertThatIOException().isThrownBy(() -> inputStream.checkedRead(buffer, 0, buffer.length))

@ -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.
@ -85,14 +85,14 @@ class FrameTests {
}
@Test
void readFragmentedNotSupported() throws Exception {
void readFragmentedNotSupported() {
byte[] bytes = new byte[] { 0x0F };
assertThatIllegalStateException().isThrownBy(() -> Frame.read(newConnectionInputStream(bytes)))
.withMessageContaining("Fragmented frames are not supported");
}
@Test
void readLargeFramesNotSupported() throws Exception {
void readLargeFramesNotSupported() {
byte[] bytes = new byte[] { (byte) 0x80, (byte) 0xFF };
assertThatIllegalStateException().isThrownBy(() -> Frame.read(newConnectionInputStream(bytes)))
.withMessageContaining("Large frames are not supported");

@ -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.
@ -112,7 +112,7 @@ class LiveReloadServerTests {
assertThat(this.server.getClosedExceptions().size()).isGreaterThan(0);
}
private void awaitClosedException() throws InterruptedException {
private void awaitClosedException() {
Awaitility.waitAtMost(Duration.ofSeconds(10)).until(this.server::getClosedExceptions, is(not(empty())));
}

@ -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.
@ -69,7 +69,7 @@ class DelayedLiveReloadTriggerTests {
private DelayedLiveReloadTrigger trigger;
@BeforeEach
void setup() throws IOException {
void setup() {
this.trigger = new DelayedLiveReloadTrigger(this.liveReloadServer, this.requestFactory, URL);
}

@ -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.
@ -62,7 +62,7 @@ class HttpHeaderInterceptorTests {
private MockHttpServletRequest httpRequest;
@BeforeEach
void setup() throws Exception {
void setup() {
this.body = new byte[] {};
this.httpRequest = new MockHttpServletRequest();
this.request = new ServletServerHttpRequest(this.httpRequest);

@ -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.
@ -57,13 +57,13 @@ class MainMethodTests {
}
@Test
void missingArgsMainMethod() throws Exception {
void missingArgsMainMethod() {
assertThatIllegalStateException().isThrownBy(() -> new TestThread(MissingArgs::main).test())
.withMessageContaining("Unable to find main method");
}
@Test
void nonStatic() throws Exception {
void nonStatic() {
assertThatIllegalStateException().isThrownBy(() -> new TestThread(() -> new NonStaticMain().main()).test())
.withMessageContaining("Unable to find main method");
}

@ -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;
}

@ -185,7 +185,7 @@ class RestartClassLoaderTests {
}
@Test
void getDeletedClass() throws Exception {
void getDeletedClass() {
String name = PACKAGE_PATH + "/Sample.class";
this.updatedFiles.addFile(name, new ClassLoaderFile(Kind.DELETED, null));
assertThatExceptionOfType(ClassNotFoundException.class)
@ -193,7 +193,7 @@ class RestartClassLoaderTests {
}
@Test
void getUpdatedClass() throws Exception {
void getUpdatedClass() {
String name = PACKAGE_PATH + "/Sample.class";
this.updatedFiles.addFile(name, new ClassLoaderFile(Kind.MODIFIED, new byte[10]));
assertThatExceptionOfType(ClassFormatError.class)

@ -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.
@ -63,7 +63,7 @@ class HttpTunnelPayloadForwarderTests {
}
@Test
void overflow() throws Exception {
void overflow() {
WritableByteChannel channel = Channels.newChannel(new ByteArrayOutputStream());
HttpTunnelPayloadForwarder forwarder = new HttpTunnelPayloadForwarder(channel);
assertThatIllegalStateException().isThrownBy(() -> {

@ -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.
@ -93,7 +93,7 @@ class HttpTunnelPayloadTests {
}
@Test
void getWithMissingHeader() throws Exception {
void getWithMissingHeader() {
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setContent("hello".getBytes());
HttpInputMessage request = new ServletServerHttpRequest(servletRequest);

@ -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.
@ -83,7 +83,7 @@ class HttpTunnelServerTests {
private MockServerChannel serverChannel;
@BeforeEach
void setup() throws Exception {
void setup() {
this.server = new HttpTunnelServer(this.serverConnection);
this.servletRequest = new MockHttpServletRequest();
this.servletRequest.setAsyncSupported(true);

@ -47,7 +47,7 @@ class MetricsHealthMicrometerExportTests {
private MeterRegistry registry;
@Test
void registryExportsHealth() throws Exception {
void registryExportsHealth() {
Gauge gauge = this.registry.get("health").gauge();
assertThat(gauge.value()).isEqualTo(2);
}

@ -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 WebTestClientRestDocsAutoConfigurationAdvancedConfigurationIntegrationTest
}
@Test
void defaultSnippetsAreWritten() throws Exception {
void defaultSnippetsAreWritten() {
this.webTestClient.get().uri("/").exchange().expectStatus().is2xxSuccessful().expectBody()
.consumeWith(document("default-snippets"));
File defaultSnippetsDir = new File(this.generatedSnippets, "default-snippets");

@ -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.
@ -54,7 +54,7 @@ class WebTestClientRestDocsAutoConfigurationIntegrationTests {
}
@Test
void defaultSnippetsAreWritten() throws Exception {
void defaultSnippetsAreWritten() {
this.webTestClient.get().uri("/").exchange().expectStatus().is2xxSuccessful().expectBody()
.consumeWith(document("default-snippets"));
File defaultSnippetsDir = new File(this.generatedSnippets, "default-snippets");

@ -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.
@ -67,7 +67,7 @@ class WebTestClientSpringBootTestIntegrationTests {
static class TestConfiguration {
@Bean
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) throws Exception {
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange((exchanges) -> exchanges.anyExchange().permitAll());
return http.build();
}

@ -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.
@ -70,7 +70,7 @@ class WebMvcTestAllControllersIntegrationTests {
}
@Test
void shouldRunValidationFailure() throws Exception {
void shouldRunValidationFailure() {
assertThatExceptionOfType(NestedServletException.class)
.isThrownBy(() -> this.mvc.perform(get("/three/invalid")))
.withCauseInstanceOf(ConstraintViolationException.class);

@ -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.
@ -116,7 +116,7 @@ class JsonContentAssertTests {
}
@Test
void isEqualToWhenFileIsNotMatchingShouldFail() throws Exception {
void isEqualToWhenFileIsNotMatchingShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isEqualTo(createFile(DIFFERENT)));
}
@ -199,7 +199,7 @@ class JsonContentAssertTests {
}
@Test
void isEqualToJsonWhenFileIsNotMatchingShouldFail() throws Exception {
void isEqualToJsonWhenFileIsNotMatchingShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isEqualToJson(createFile(DIFFERENT)));
}
@ -276,7 +276,7 @@ class JsonContentAssertTests {
}
@Test
void isStrictlyEqualToJsonWhenFileIsNotMatchingShouldFail() throws Exception {
void isStrictlyEqualToJsonWhenFileIsNotMatchingShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createFile(LENIENT_SAME)));
}
@ -430,7 +430,7 @@ class JsonContentAssertTests {
}
@Test
void isEqualToJsonWhenFileIsNotMatchingAndComparatorShouldFail() throws Exception {
void isEqualToJsonWhenFileIsNotMatchingAndComparatorShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isEqualToJson(createFile(DIFFERENT), COMPARATOR));
}
@ -496,7 +496,7 @@ class JsonContentAssertTests {
}
@Test
void isNotEqualToWhenFileIsMatchingShouldFail() throws Exception {
void isNotEqualToWhenFileIsMatchingShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isNotEqualTo(createFile(LENIENT_SAME)));
}
@ -578,7 +578,7 @@ class JsonContentAssertTests {
}
@Test
void isNotEqualToJsonWhenFileIsMatchingShouldFail() throws Exception {
void isNotEqualToJsonWhenFileIsMatchingShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME)));
}
@ -655,7 +655,7 @@ class JsonContentAssertTests {
}
@Test
void isNotStrictlyEqualToJsonWhenFileIsMatchingShouldFail() throws Exception {
void isNotStrictlyEqualToJsonWhenFileIsMatchingShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createFile(SOURCE)));
}
@ -732,7 +732,7 @@ class JsonContentAssertTests {
}
@Test
void isNotEqualToJsonWhenFileIsMatchingAndLenientShouldFail() throws Exception {
void isNotEqualToJsonWhenFileIsMatchingAndLenientShouldFail() {
assertThatExceptionOfType(AssertionError.class).isThrownBy(
() -> assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME), JSONCompareMode.LENIENT));
}
@ -809,7 +809,7 @@ class JsonContentAssertTests {
}
@Test
void isNotEqualToJsonWhenFileIsMatchingAndComparatorShouldFail() throws Exception {
void isNotEqualToJsonWhenFileIsMatchingAndComparatorShouldFail() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME), COMPARATOR));
}

@ -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;
}

@ -125,7 +125,7 @@ class TestRestTemplateTests {
}
@Test
void authenticated() throws Exception {
void authenticated() {
TestRestTemplate restTemplate = new TestRestTemplate("user", "password");
assertBasicAuthorizationCredentials(restTemplate, "user", "password");
}
@ -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();
@ -200,7 +200,7 @@ class TestRestTemplateTests {
}
@Test
void withBasicAuthAddsBasicAuthWhenNotAlreadyPresent() throws Exception {
void withBasicAuthAddsBasicAuthWhenNotAlreadyPresent() {
TestRestTemplate original = new TestRestTemplate();
TestRestTemplate basicAuth = original.withBasicAuth("user", "password");
assertThat(getConverterClasses(original)).containsExactlyElementsOf(getConverterClasses(basicAuth));
@ -210,7 +210,7 @@ class TestRestTemplateTests {
}
@Test
void withBasicAuthReplacesBasicAuthWhenAlreadyPresent() throws Exception {
void withBasicAuthReplacesBasicAuthWhenAlreadyPresent() {
TestRestTemplate original = new TestRestTemplate("foo", "bar").withBasicAuth("replace", "replace");
TestRestTemplate basicAuth = original.withBasicAuth("user", "password");
assertThat(getConverterClasses(basicAuth)).containsExactlyElementsOf(getConverterClasses(original));
@ -366,7 +366,7 @@ class TestRestTemplateTests {
}
private void assertBasicAuthorizationCredentials(TestRestTemplate testRestTemplate, String username,
String password) throws Exception {
String password) {
ClientHttpRequest request = ReflectionTestUtils.invokeMethod(testRestTemplate.getRestTemplate(),
"createRequest", URI.create("http://localhost"), HttpMethod.POST);
if (username == 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.
@ -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();
}

@ -53,7 +53,7 @@ class BuildpackResolversTests extends AbstractJsonTests {
}
@Test
void resolveAllWithBuilderBuildpackReferenceReturnsExpectedBuildpack() throws IOException {
void resolveAllWithBuilderBuildpackReferenceReturnsExpectedBuildpack() {
BuildpackReference reference = BuildpackReference.of("urn:cnb:builder:paketo-buildpacks/spring-boot@3.5.0");
Buildpacks buildpacks = BuildpackResolvers.resolveAll(this.resolverContext, Collections.singleton(reference));
assertThat(buildpacks.getBuildpacks()).hasSize(1);
@ -92,7 +92,7 @@ class BuildpackResolversTests extends AbstractJsonTests {
}
@Test
void resolveAllWithInvalidLocatorThrowsException() throws IOException {
void resolveAllWithInvalidLocatorThrowsException() {
BuildpackReference reference = BuildpackReference.of("unknown-buildpack@0.0.1");
assertThatIllegalArgumentException()
.isThrownBy(() -> BuildpackResolvers.resolveAll(this.resolverContext, Collections.singleton(reference)))

@ -105,7 +105,7 @@ class ImageBuildpackTests extends AbstractJsonTests {
}
@Test
void resolveWhenFullyQualifiedReferenceWithInvalidImageReferenceThrowsException() throws Exception {
void resolveWhenFullyQualifiedReferenceWithInvalidImageReferenceThrowsException() {
BuildpackReference reference = BuildpackReference.of("docker://buildpack@0.0.1");
BuildpackResolverContext resolverContext = mock(BuildpackResolverContext.class);
assertThatIllegalArgumentException().isThrownBy(() -> ImageBuildpack.resolve(resolverContext, reference))
@ -113,7 +113,7 @@ class ImageBuildpackTests extends AbstractJsonTests {
}
@Test
void resolveWhenUnqualifiedReferenceWithInvalidImageReferenceReturnsNull() throws Exception {
void resolveWhenUnqualifiedReferenceWithInvalidImageReferenceReturnsNull() {
BuildpackReference reference = BuildpackReference.of("buildpack@0.0.1");
BuildpackResolverContext resolverContext = mock(BuildpackResolverContext.class);
Buildpack buildpack = ImageBuildpack.resolve(resolverContext, reference);

@ -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.
@ -41,7 +41,7 @@ class MappedObjectTests extends AbstractJsonTests {
}
@Test
void ofReadsJson() throws Exception {
void ofReadsJson() {
assertThat(this.mapped.getNode()).isNotNull();
}

@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurationMetadataTests {
@Test
void nullResource() throws IOException {
void nullResource() {
assertThatIllegalArgumentException()
.isThrownBy(() -> ConfigurationMetadataRepositoryJsonBuilder.create().withJsonResource(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.
@ -46,7 +46,7 @@ class JsonReaderTests extends AbstractConfigurationMetadataTests {
}
@Test
void invalidMetadata() throws IOException {
void invalidMetadata() {
assertThatIllegalStateException().isThrownBy(() -> readFor("invalid")).withCauseInstanceOf(JSONException.class);
}

@ -243,7 +243,7 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene
}
@Test
void parseArrayConfig() throws Exception {
void parseArrayConfig() {
ConfigurationMetadata metadata = compile(SimpleArrayProperties.class);
assertThat(metadata).has(Metadata.withGroup("array").ofType(SimpleArrayProperties.class));
assertThat(metadata).has(Metadata.withProperty("array.primitive", "java.lang.Integer[]"));

@ -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.
@ -41,14 +41,14 @@ class IntegratingWithActuatorDocumentationTests {
GradleBuild gradleBuild;
@TestTemplate
void basicBuildInfo() throws IOException {
void basicBuildInfo() {
this.gradleBuild.script("src/docs/gradle/integrating-with-actuator/build-info-basic").build("bootBuildInfo");
assertThat(new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties"))
.isFile();
}
@TestTemplate
void buildInfoCustomValues() throws IOException {
void buildInfoCustomValues() {
this.gradleBuild.script("src/docs/gradle/integrating-with-actuator/build-info-custom-values")
.build("bootBuildInfo");
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");
@ -61,7 +61,7 @@ class IntegratingWithActuatorDocumentationTests {
}
@TestTemplate
void buildInfoAdditional() throws IOException {
void buildInfoAdditional() {
this.gradleBuild.script("src/docs/gradle/integrating-with-actuator/build-info-additional")
.build("bootBuildInfo");
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");

@ -16,8 +16,6 @@
package org.springframework.boot.gradle.docs;
import java.io.IOException;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
@ -41,14 +39,14 @@ class PublishingDocumentationTests {
@DisabledForJreRange(min = JRE.JAVA_16)
@TestTemplate
void mavenUpload() throws IOException {
void mavenUpload() {
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("5.6")
.script("src/docs/gradle/publishing/maven").build("deployerRepository").getOutput())
.contains("https://repo.example.com");
}
@TestTemplate
void mavenPublish() throws IOException {
void mavenPublish() {
assertThat(this.gradleBuild.script("src/docs/gradle/publishing/maven-publish").build("publishingConfiguration")
.getOutput()).contains("MavenPublication").contains("https://repo.example.com");
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save