Polish "Remove unnecessary throws declaration in tests"
See gh-26441
This commit is contained in:
@@ -26,9 +26,7 @@ import java.nio.file.StandardOpenOption;
|
||||
import java.time.Instant;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.gradle.testkit.runner.InvalidRunnerConfigurationException;
|
||||
import org.gradle.testkit.runner.TaskOutcome;
|
||||
import org.gradle.testkit.runner.UnexpectedBuildFailure;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
|
||||
import org.springframework.boot.gradle.junit.GradleCompatibility;
|
||||
@@ -111,8 +109,7 @@ class BuildInfoIntegrationTests {
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void reproducibleOutputWithFixedTime()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
||||
void reproducibleOutputWithFixedTime() throws IOException, InterruptedException {
|
||||
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
||||
.isEqualTo(TaskOutcome.SUCCESS);
|
||||
File buildInfoProperties = new File(this.gradleBuild.getProjectDir(), "build/build-info.properties");
|
||||
|
||||
@@ -46,9 +46,7 @@ import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import org.gradle.testkit.runner.BuildResult;
|
||||
import org.gradle.testkit.runner.InvalidRunnerConfigurationException;
|
||||
import org.gradle.testkit.runner.TaskOutcome;
|
||||
import org.gradle.testkit.runner.UnexpectedBuildFailure;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
|
||||
import org.springframework.boot.gradle.testkit.GradleBuild;
|
||||
@@ -92,8 +90,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void reproducibleArchive()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
||||
void reproducibleArchive() throws IOException, InterruptedException {
|
||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||
.isEqualTo(TaskOutcome.SUCCESS);
|
||||
File jar = new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0];
|
||||
@@ -229,8 +226,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure {
|
||||
void upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered() {
|
||||
assertThat(this.gradleBuild.scriptProperty("layered", "").build("" + this.taskName).task(":" + this.taskName)
|
||||
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(this.gradleBuild.scriptProperty("layered", "layered {}").build("" + this.taskName)
|
||||
@@ -238,8 +234,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void notUpToDateWhenBuiltWithoutLayersAndThenWithLayers()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure {
|
||||
void notUpToDateWhenBuiltWithoutLayersAndThenWithLayers() {
|
||||
assertThat(this.gradleBuild.scriptProperty("layerEnablement", "enabled = false").build(this.taskName)
|
||||
.task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(this.gradleBuild.scriptProperty("layerEnablement", "enabled = true").build(this.taskName)
|
||||
@@ -247,8 +242,7 @@ abstract class AbstractBootArchiveIntegrationTests {
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools()
|
||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure {
|
||||
void notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools() {
|
||||
assertThat(this.gradleBuild.scriptProperty("layerTools", "").build(this.taskName).task(":" + this.taskName)
|
||||
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(this.gradleBuild.scriptProperty("layerTools", "includeLayerTools = false").build(this.taskName)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,6 @@ import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.extension.Extension;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
|
||||
@@ -84,14 +83,12 @@ class MavenBuildExtension implements TestTemplateInvocationContextProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
return parameterContext.getParameter().getType().equals(MavenBuild.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
|
||||
return new MavenBuild(this.mavenHome.toFile());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user