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

@@ -42,7 +42,7 @@ class ClassPathIndexFileTests {
File temp;
@Test
void loadIfPossibleWhenRootIsNotFileReturnsNull() throws IOException {
void loadIfPossibleWhenRootIsNotFileReturnsNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> ClassPathIndexFile.loadIfPossible(new URL("https://example.com/file"), "test.idx"))
.withMessage("URL does not reference a file");
@@ -95,7 +95,7 @@ class ClassPathIndexFileTests {
}
}
private ClassPathIndexFile copyAndLoadTestIndexFile() throws IOException, MalformedURLException {
private ClassPathIndexFile copyAndLoadTestIndexFile() throws IOException {
copyTestIndexFile();
ClassPathIndexFile indexFile = ClassPathIndexFile.loadIfPossible(this.temp.toURI().toURL(), "test.idx");
return indexFile;

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.
@@ -401,7 +401,7 @@ class PropertiesLauncherTests {
assertThat(bytes).isNotEmpty();
}
private void waitFor(String value) throws Exception {
private void waitFor(String value) {
Awaitility.waitAtMost(Duration.ofSeconds(5)).until(this.output::toString, containsString(value));
}

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.
@@ -96,23 +96,23 @@ class RandomAccessDataFileTests {
}
@Test
void readWhenOffsetIsBeyondEOFShouldThrowException() throws Exception {
void readWhenOffsetIsBeyondEOFShouldThrowException() {
assertThatExceptionOfType(IndexOutOfBoundsException.class).isThrownBy(() -> this.file.read(257, 0));
}
@Test
void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException() throws Exception {
void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException() {
RandomAccessData subsection = this.file.getSubsection(0, 10);
assertThatExceptionOfType(IndexOutOfBoundsException.class).isThrownBy(() -> subsection.read(11, 0));
}
@Test
void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException() throws Exception {
void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException() {
assertThatExceptionOfType(EOFException.class).isThrownBy(() -> this.file.read(256, 1));
}
@Test
void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException() throws Exception {
void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException() {
RandomAccessData subsection = this.file.getSubsection(0, 10);
assertThatExceptionOfType(EOFException.class).isThrownBy(() -> subsection.read(10, 1));
}
@@ -125,13 +125,13 @@ class RandomAccessDataFileTests {
}
@Test
void inputStreamReadNullBytes() throws Exception {
void inputStreamReadNullBytes() {
assertThatNullPointerException().isThrownBy(() -> this.inputStream.read(null))
.withMessage("Bytes must not be null");
}
@Test
void inputStreamReadNullBytesWithOffset() throws Exception {
void inputStreamReadNullBytesWithOffset() {
assertThatNullPointerException().isThrownBy(() -> this.inputStream.read(null, 0, 1))
.withMessage("Bytes must not be null");
}