Remove unused exceptions from test method signatures
MODIFY
src/test/java/org/apache/commons/io/FileUtilsTest.java
src/test/java/org/apache/commons/io/FileUtilsTest.java
@@ -1279,7 +1279,7 @@ public void testCopyURLToFileWithTimeout() throws Exception {
* Tests a directory with one file of size 0.
*/
@Test
- public void testCountFolders1FileSize0() throws IOException {
+ public void testCountFolders1FileSize0() {
assertEquals(0, FileUtils.sizeOfDirectory(Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-0").toFile()));
}
@@ -1287,7 +1287,7 @@ public void testCountFolders1FileSize0() throws IOException {
* Tests a directory with one file of size 1.
*/
@Test
- public void testCountFolders1FileSize1() throws IOException {
+ public void testCountFolders1FileSize1() {
assertEquals(1, FileUtils.sizeOfDirectory(Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-1").toFile()));
}
@@ -1295,7 +1295,7 @@ public void testCountFolders1FileSize1() throws IOException {
* Tests a directory with two subdirectories, each containing one file of size 1.
*/
@Test
- public void testCountFolders2FileSize2() throws IOException {
+ public void testCountFolders2FileSize2() {
assertEquals(2, FileUtils.sizeOfDirectory(Paths.get("src/test/resources/org/apache/commons/io/dirs-2-file-size-2").toFile()));
}
@@ -1303,7 +1303,7 @@ public void testCountFolders2FileSize2() throws IOException {
* Tests a directory with two subdirectories, each containing one file of size 1.
*/
@Test
- public void testCountFolders2FileSize4() throws IOException {
+ public void testCountFolders2FileSize4() {
assertEquals(8, FileUtils.sizeOfDirectory(Paths.get("src/test/resources/org/apache/commons/io/dirs-2-file-size-4").toFile()));
}

MODIFY
src/test/java/org/apache/commons/io/FilenameUtilsTest.java
src/test/java/org/apache/commons/io/FilenameUtilsTest.java
@@ -138,7 +138,7 @@ public void testConcat() {
//-----------------------------------------------------------------------
@Test
- public void testDirectoryContains() throws IOException {
+ public void testDirectoryContains() {
assertTrue(FilenameUtils.directoryContains("/foo", "/foo/bar"));
assertTrue(FilenameUtils.directoryContains("/foo/", "/foo/bar"));
assertTrue(FilenameUtils.directoryContains("C:\\foo", "C:\\foo\\bar"));

MODIFY
src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
@@ -74,7 +74,7 @@ public void testBufferSmallest() throws IOException {
}
@Test
- public void testBufferTooSmall() throws IOException {
+ public void testBufferTooSmall() {
assertThrows(IllegalArgumentException.class, () -> new ReaderInputStream(new StringReader("\uD800"), StandardCharsets.UTF_8, -1));
assertThrows(IllegalArgumentException.class, () -> new ReaderInputStream(new StringReader("\uD800"), StandardCharsets.UTF_8, 0));
assertThrows(IllegalArgumentException.class, () -> new ReaderInputStream(new StringReader("\uD800"), StandardCharsets.UTF_8, 1));

MODIFY
src/test/java/org/apache/commons/io/output/LockableFileWriterTest.java
src/test/java/org/apache/commons/io/output/LockableFileWriterTest.java
@@ -86,7 +86,7 @@ public void testConstructor_File_directory() {
}
@Test
- public void testConstructor_File_encoding_badEncoding() throws IOException {
+ public void testConstructor_File_encoding_badEncoding() {
assertThrows(UnsupportedCharsetException.class, () -> new LockableFileWriter(file, "BAD-ENCODE"));
assertFalse(file.exists());
assertFalse(lockFile.exists());
@@ -96,7 +96,7 @@ public void testConstructor_File_encoding_badEncoding() throws IOException {
}
@Test
- public void testConstructor_File_nullFile() throws IOException {
+ public void testConstructor_File_nullFile() {
assertThrows(NullPointerException.class, () -> new LockableFileWriter((File) null));
assertFalse(file.exists());
assertFalse(lockFile.exists());
@@ -106,7 +106,7 @@ public void testConstructor_File_nullFile() throws IOException {
}
@Test
- public void testConstructor_fileName_nullFile() throws IOException {
+ public void testConstructor_fileName_nullFile() {
assertThrows(NullPointerException.class, () -> new LockableFileWriter((String) null));
assertFalse(file.exists());
assertFalse(lockFile.exists());

Remove unused exceptions from test method signatures