File: 003_assertThrows.patch

package info (click to toggle)
libcommons-fileupload-java 1.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 976 kB
  • sloc: java: 4,840; xml: 2,228; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Origin: upstream, 2317552993fd5180a84083d599b8cbdb05a07bab
From: Allon Murienik <mureinik@gmail.com>
Date: Mon, 7 Oct 2019 16:28:36 +0300
Subject: FILEUPLOAD-302: JUnit Jupiter migration (#23)

Debian: Backport one assertThrows of the original commit.
---
--- a/src/test/java/org/apache/commons/fileupload/DiskFileItemSerializeTest.java
+++ b/src/test/java/org/apache/commons/fileupload/DiskFileItemSerializeTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.fileupload;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -146,13 +147,13 @@ public void testValidRepository() {
     /**
      * Test deserialization fails when repository contains a null character.
      */
-    @Test(expected=IOException.class)
-    public void testInvalidRepositoryWithNullChar() throws Exception {
+    @Test
+    public void testInvalidRepositoryWithNullChar() {
         // Create the FileItem
         byte[] testFieldValueBytes = createContentBytes(threshold);
         File repository = new File(System.getProperty("java.io.tmpdir"), "\0");
         FileItem item = createFileItem(testFieldValueBytes, repository);
-        deserialize(serialize(item));
+        assertThrows(IOException.class, () -> deserialize(serialize(item)));
     }
 
     /**