Polish "Remove unnecessary throws declaration in tests"

See gh-26441
This commit is contained in:
Stephane Nicoll
2021-05-17 09:32:04 +02:00
parent 8a2be288a3
commit d3c817b7ba
49 changed files with 106 additions and 164 deletions

View File

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

View 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.
@@ -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();

View 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.
@@ -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();