Remove unnecessary throws declaration in tests

See gh-26441
This commit is contained in:
weixsun
2021-05-13 00:22:53 +08:00
committed by Stephane Nicoll
parent 574655dc84
commit 8a2be288a3
129 changed files with 345 additions and 369 deletions

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

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

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

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