This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git

commit e41386fb9b7490319dc15a911a11d382be578483
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Aug 25 12:09:10 2024 -0400

    Let JUnit handle IOException
---
 .../java/org/apache/commons/fileupload/DefaultFileItemTest.java     | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java 
b/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
index 05263f42..1fa2ee9e 100644
--- a/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
+++ b/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
@@ -127,7 +127,7 @@ public class DefaultFileItemTest {
      * @param repository The directory within which temporary files will be
      *                   created.
      */
-    public void doTestAboveThreshold(final File repository) {
+    private void doTestAboveThreshold(final File repository) throws 
IOException {
         final FileItemFactory factory = createFactory(repository);
         final String textFieldName = "textField";
         final String textFieldValue = "01234567890123456789";
@@ -143,8 +143,6 @@ public class DefaultFileItemTest {
 
         try (OutputStream os = item.getOutputStream()) {
             os.write(testFieldValueBytes);
-        } catch(final IOException e) {
-            fail("Unexpected IOException");
         }
         assertFalse(item.isInMemory());
         assertEquals(item.getSize(), testFieldValueBytes.length);
@@ -170,7 +168,7 @@ public class DefaultFileItemTest {
      * configured threshold, where no specific repository is configured.
      */
     @Test
-    public void testAboveThresholdDefaultRepository() {
+    public void testAboveThresholdDefaultRepository() throws IOException {
         doTestAboveThreshold(null);
     }
 

Reply via email to