Skip to content

Commit c2e633a

Browse files
committed
Simplify using assertDoesNotThrow
1 parent 6034619 commit c2e633a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/test/java/org/apache/commons/io/IOUtilsTestCase.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.commons.io;
1818

1919
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
20+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
2021
import static org.junit.jupiter.api.Assertions.assertEquals;
2122
import static org.junit.jupiter.api.Assertions.assertFalse;
2223
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -137,18 +138,18 @@ public void setUp() {
137138
}
138139
}
139140

140-
@SuppressWarnings("squid:S2699") // Suppress "Add at least one assertion to this test case"
141141
@Test public void testCloseQuietly_AllCloseableIOException() {
142142
final Closeable closeable = () -> {
143143
throw new IOException();
144144
};
145-
IOUtils.closeQuietly(closeable, null, closeable);
145+
assertDoesNotThrow(() -> IOUtils.closeQuietly(closeable, null, closeable));
146146
}
147147

148-
@SuppressWarnings("squid:S2699") // Suppress "Add at least one assertion to this test case"
149148
@Test public void testCloseQuietly_CloseableIOException() {
150-
IOUtils.closeQuietly((Closeable) () -> {
151-
throw new IOException();
149+
assertDoesNotThrow(() -> {
150+
IOUtils.closeQuietly((Closeable) () -> {
151+
throw new IOException();
152+
});
152153
});
153154
}
154155

0 commit comments

Comments
 (0)