Simplify using assertDoesNotThrow
package org.apache.commons.io;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -137,19 +138,19 @@ public void setUp() {
}
}
- @SuppressWarnings("squid:S2699") // Suppress "Add at least one assertion to this test case"
@Test public void testCloseQuietly_AllCloseableIOException() {
final Closeable closeable = () -> {
throw new IOException();
};
- IOUtils.closeQuietly(closeable, null, closeable);
+ assertDoesNotThrow(() -> IOUtils.closeQuietly(closeable, null, closeable));
}
- @SuppressWarnings("squid:S2699") // Suppress "Add at least one assertion to this test case"
@Test public void testCloseQuietly_CloseableIOException() {
+ assertDoesNotThrow(() -> {
IOUtils.closeQuietly((Closeable) () -> {
throw new IOException();
});
+ });
}
@SuppressWarnings("squid:S2699") // Suppress "Add at least one assertion to this test case"
