This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
The following commit(s) were added to refs/heads/master by this push: new 37154650 Use JUnit 5 convention for test method visibility 37154650 is described below commit 37154650b4c00b2b36e926ba8ed158dd771532ac Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jun 7 15:24:54 2025 -0400 Use JUnit 5 convention for test method visibility --- .../fileupload2/core/AbstractFileUploadTest.java | 18 +++++++++--------- .../core/AbstractProgressListenerTest.java | 2 +- .../fileupload2/core/AbstractSizesTest.java | 8 ++++---- .../fileupload2/core/AbstractStreamingTest.java | 10 +++++----- .../core/DiskFileItemSerializeTest.java | 12 ++++++------ .../commons/fileupload2/core/DiskFileItemTest.java | 4 ++-- .../fileupload2/core/FileItemHeadersTest.java | 2 +- .../fileupload2/core/MimeUtilityTestCase.java | 12 ++++++------ .../fileupload2/core/MockRequestContextTest.java | 6 +++--- .../fileupload2/core/MultipartStreamTest.java | 6 +++--- .../fileupload2/core/ParameterParserTest.java | 12 ++++++------ .../core/QuotedPrintableDecoderTestCase.java | 22 +++++++++++----------- .../fileupload2/core/RFC2231UtilityTestCase.java | 12 ++++++------ .../servlet5/JakartaServletFileUploadDiskTest.java | 4 ++-- .../servlet5/JakartaServletFileUploadTest.java | 4 ++-- .../servlet6/JakartaServletFileUploadDiskTest.java | 4 ++-- .../servlet6/JakartaServletFileUploadTest.java | 4 ++-- .../javax/JavaxServletFileUploadDiskTest.java | 6 +++--- .../javax/JavaxServletFileUploadTest.java | 4 ++-- .../portlet/JavaxPortletFileUploadTest.java | 2 +- 20 files changed, 77 insertions(+), 77 deletions(-) diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractFileUploadTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractFileUploadTest.java index edda5fd1..9eb4ec99 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractFileUploadTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractFileUploadTest.java @@ -59,7 +59,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I * @throws IOException Test failure. */ @Test - public void testContentTypeAttachment() throws IOException { + void testContentTypeAttachment() throws IOException { // @formatter:off final var fileItems = parseUpload(upload, "-----1234\r\n" + @@ -99,7 +99,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I * @throws FileUploadException Test failure. */ @Test - public void testEmptyFile() throws IOException { + void testEmptyFile() throws IOException { // @formatter:off final var fileItems = parseUpload (upload, "-----1234\r\n" + @@ -117,7 +117,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I } @Test - public void testFileNameCaseSensitivity() throws IOException { + void testFileNameCaseSensitivity() throws IOException { // @formatter:off final var fileItems = parseUpload(upload, "-----1234\r\n" + @@ -137,7 +137,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I } @Test - public void testFileUpload() throws IOException { + void testFileUpload() throws IOException { // @formatter:off final var fileItems = parseUpload(upload, "-----1234\r\n" + @@ -192,7 +192,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I * @throws IOException Test failure. */ @Test - public void testFileUpload130() throws IOException { + void testFileUpload130() throws IOException { final String[] headerNames = { "SomeHeader", "OtherHeader", "YetAnotherHeader", "WhatAHeader" }; final String[] headerValues = { "present", "Is there", "Here", "Is That" }; // @formatter:off @@ -245,7 +245,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I * @throws IOException Test failure. */ @Test - public void testFILEUPLOAD62() throws IOException { + void testFILEUPLOAD62() throws IOException { // @formatter:off final var contentType = "multipart/form-data; boundary=AaB03x"; final var request = @@ -293,7 +293,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I * @throws IOException Test failure. */ @Test - public void testFoldedHeaders() throws IOException { + void testFoldedHeaders() throws IOException { // @formatter:off final var fileItems = parseUpload(upload, "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" + @@ -349,7 +349,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I * @throws FileUploadException Test failure. */ @Test - public void testIE5MacBug() throws IOException { + void testIE5MacBug() throws IOException { final var fileItems = parseUpload(upload, // @formatter:off "-----1234\r\n" + @@ -399,7 +399,7 @@ public abstract class AbstractFileUploadTest<AFU extends AbstractFileUpload<R, I * This kind of Content-Type is commonly used by SOAP-Requests with Attachments (MTOM) */ @Test - public void testMultipleRelated() throws Exception { + void testMultipleRelated() throws Exception { final String soapEnvelope = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">\r\n" + " <soap:Header></soap:Header>\r\n" + diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractProgressListenerTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractProgressListenerTest.java index 637906a8..b6d854b5 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractProgressListenerTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractProgressListenerTest.java @@ -102,7 +102,7 @@ public abstract class AbstractProgressListenerTest<AFU extends AbstractFileUploa * @throws IOException Test failure. */ @Test - public void testProgressListener() throws IOException { + void testProgressListener() throws IOException { final var numItems = 512; final var baos = new ByteArrayOutputStream(); for (var i = 0; i < numItems; i++) { diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java index 37bac01a..3f7beed8 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java @@ -45,7 +45,7 @@ public abstract class AbstractSizesTest<AFU extends AbstractFileUpload<R, I, F>, * @throws IOException Test failure. */ @Test - public void testFileSizeLimit() throws IOException { + void testFileSizeLimit() throws IOException { final var content = "This is the content of the file\n"; final var contentSize = content.getBytes().length; @@ -111,7 +111,7 @@ public abstract class AbstractSizesTest<AFU extends AbstractFileUpload<R, I, F>, * @throws IOException Test failure. */ @Test - public void testFileSizeLimitWithFakedContentLength() throws IOException { + void testFileSizeLimitWithFakedContentLength() throws IOException { // @formatter:off final var request = "-----1234\r\n" + @@ -169,7 +169,7 @@ public abstract class AbstractSizesTest<AFU extends AbstractFileUpload<R, I, F>, * @throws IOException Test failure. */ @Test - public void testMaxSizeLimit() throws IOException { + void testMaxSizeLimit() throws IOException { // @formatter:off final var request = "-----1234\r\n" + @@ -202,7 +202,7 @@ public abstract class AbstractSizesTest<AFU extends AbstractFileUpload<R, I, F>, } @Test - public void testMaxSizeLimitUnknownContentLength() throws IOException { + void testMaxSizeLimitUnknownContentLength() throws IOException { // @formatter:off final var request = "-----1234\r\n" + diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractStreamingTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractStreamingTest.java index e03ea9fc..4043421a 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractStreamingTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractStreamingTest.java @@ -122,7 +122,7 @@ public abstract class AbstractStreamingTest<AFU extends AbstractFileUpload<R, I, * @throws IOException Test failure. */ @Test - public void testFileUpload() throws IOException { + void testFileUpload() throws IOException { final var request = newRequest(); final var fileItems = parseUpload(request); final var fileIter = fileItems.iterator(); @@ -149,7 +149,7 @@ public abstract class AbstractStreamingTest<AFU extends AbstractFileUpload<R, I, * @throws IOException Test failure. */ @Test - public void testFILEUPLOAD135() throws IOException { + void testFILEUPLOAD135() throws IOException { final var request = newShortRequest(); final var bais = new ByteArrayInputStream(request); final var fileItems = parseUpload(new InputStream() { @@ -182,7 +182,7 @@ public abstract class AbstractStreamingTest<AFU extends AbstractFileUpload<R, I, * @throws IOException Test failure. */ @Test - public void testFileUploadException() throws IOException { + void testFileUploadException() throws IOException { final var request = newRequest(); final var invalidRequest = new byte[request.length - 11]; System.arraycopy(request, 0, invalidRequest, 0, request.length - 11); @@ -200,7 +200,7 @@ public abstract class AbstractStreamingTest<AFU extends AbstractFileUpload<R, I, * @throws IOException Test failure. */ @Test - public void testInvalidFileNameException() throws IOException { + void testInvalidFileNameException() throws IOException { final var fileName = "foo.exe\u0000.png"; // @formatter:off final var request = @@ -255,7 +255,7 @@ public abstract class AbstractStreamingTest<AFU extends AbstractFileUpload<R, I, * @throws IOException Test failure. */ @Test - public void testIOException() throws IOException { + void testIOException() throws IOException { final var request = newRequest(); final InputStream stream = new FilterInputStream(new ByteArrayInputStream(request)) { private int num; diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemSerializeTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemSerializeTest.java index 4234c1bd..2ec55db7 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemSerializeTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemSerializeTest.java @@ -167,7 +167,7 @@ public class DiskFileItemSerializeTest { * @throws IOException Test failure. */ @Test - public void testAboveThreshold() throws IOException { + void testAboveThreshold() throws IOException { // Create the FileItem final var testFieldValueBytes = createContentBytes(THRESHOLD + 1); final var item = createFileItem(testFieldValueBytes); @@ -187,14 +187,14 @@ public class DiskFileItemSerializeTest { * @throws IOException Test failure. */ @Test - public void testBelowThreshold() throws IOException { + void testBelowThreshold() throws IOException { // Create the FileItem final var testFieldValueBytes = createContentBytes(THRESHOLD - 1); testInMemoryObject(testFieldValueBytes); } @Test - public void testCheckFileName() { + void testCheckFileName() { assertThrows(InvalidPathException.class, () -> DiskFileItem.checkFileName("\0")); } @@ -225,7 +225,7 @@ public class DiskFileItemSerializeTest { * @throws IOException Test failure. */ @Test - public void testInvalidRepository() throws IOException { + void testInvalidRepository() throws IOException { // Create the FileItem final var testFieldValueBytes = createContentBytes(THRESHOLD); final var repository = PathUtils.getTempDirectory().resolve("file"); @@ -239,7 +239,7 @@ public class DiskFileItemSerializeTest { * @throws IOException Test failure. */ @Test - public void testThreshold() throws IOException { + void testThreshold() throws IOException { // Create the FileItem final var testFieldValueBytes = createContentBytes(THRESHOLD); testInMemoryObject(testFieldValueBytes); @@ -251,7 +251,7 @@ public class DiskFileItemSerializeTest { * @throws IOException Test failure. */ @Test - public void testValidRepository() throws IOException { + void testValidRepository() throws IOException { // Create the FileItem final var testFieldValueBytes = createContentBytes(THRESHOLD); testInMemoryObject(testFieldValueBytes, REPOSITORY); diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemTest.java index f0f0a8b9..1f6d1885 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; public class DiskFileItemTest { @Test - public void testBuilderHeaders() { + void testBuilderHeaders() { final var builder = DiskFileItem.builder(); assertNotNull(builder.getFileItemHeaders()); final var fileItem = builder.get(); @@ -46,7 +46,7 @@ public class DiskFileItemTest { * Tests FILEUPLOAD-352 NullPointerException in DiskFileItem#toString */ @Test - public void testToStringDefault() { + void testToStringDefault() { new DiskFileItem.Builder().get().toString(); } } diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/FileItemHeadersTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/FileItemHeadersTest.java index cb4aa9a4..2db491ed 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/FileItemHeadersTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/FileItemHeadersTest.java @@ -34,7 +34,7 @@ public class FileItemHeadersTest { * @throws Exception */ @Test - public void testFileItemHeaders() throws Exception { + void testFileItemHeaders() throws Exception { final var mutableFileItemHeaders = new FileItemHeadersImpl(); mutableFileItemHeaders.addHeader("Content-Disposition", "form-data; name=\"FileItem\"; filename=\"file1.txt\""); mutableFileItemHeaders.addHeader("Content-Type", "text/plain"); diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MimeUtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MimeUtilityTestCase.java index d37a96d8..472b9c15 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MimeUtilityTestCase.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MimeUtilityTestCase.java @@ -33,34 +33,34 @@ public final class MimeUtilityTestCase { } @Test - public void testDecodeInvalidEncoding() { + void testDecodeInvalidEncoding() { assertThrows(UnsupportedEncodingException.class, () -> MimeUtils.decodeText("=?invalid?B?xyz-?=")); } @Test - public void testDecodeIso88591Base64Encoded() throws Exception { + void testDecodeIso88591Base64Encoded() throws Exception { assertEncoded("If you can read this you understand the example.", "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= " + "=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n"); } @Test - public void testDecodeIso88591Base64EncodedWithWhiteSpace() throws Exception { + void testDecodeIso88591Base64EncodedWithWhiteSpace() throws Exception { assertEncoded("If you can read this you understand the example.", "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\t \r\n =?ISO-8859-" + "2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n"); } @Test - public void testDecodeUtf8Base64Encoded() throws Exception { + void testDecodeUtf8Base64Encoded() throws Exception { assertEncoded(" h\u00e9! \u00e0\u00e8\u00f4u !!!", "=?UTF-8?B?IGjDqSEgw6DDqMO0dSAhISE=?="); } @Test - public void testDecodeUtf8QuotedPrintableEncoded() throws Exception { + void testDecodeUtf8QuotedPrintableEncoded() throws Exception { assertEncoded(" h\u00e9! \u00e0\u00e8\u00f4u !!!", "=?UTF-8?Q?_h=C3=A9!_=C3=A0=C3=A8=C3=B4u_!!!?="); } @Test - public void testNoNeedToDecode() throws Exception { + void testNoNeedToDecode() throws Exception { assertEncoded("abc", "abc"); } } diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MockRequestContextTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MockRequestContextTest.java index d1a67a19..19f3f9b7 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MockRequestContextTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MockRequestContextTest.java @@ -144,7 +144,7 @@ public class MockRequestContextTest { * Test if the {@code content-type} is {@code multipart/related} */ @Test - public void testIsMultipartRelated() { + void testIsMultipartRelated() { final RequestContext request = new MockRequestContext( x -> "1234", () -> 5678L, @@ -159,7 +159,7 @@ public class MockRequestContextTest { * Test if the {@code content-type} is not {@code multipart/related} */ @Test - public void testIsNotMultipartRelated() { + void testIsNotMultipartRelated() { final RequestContext request = new MockRequestContext( x -> "1234", () -> 5678L, @@ -174,7 +174,7 @@ public class MockRequestContextTest { * Test the {@code toString()} Output */ @Test - public void testToString() { + void testToString() { final RequestContext request = new MockRequestContext( x -> "1234", () -> 5678L, diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java index 1391fd84..61d26afa 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java @@ -32,7 +32,7 @@ public class MultipartStreamTest { static private final String BOUNDARY_TEXT = "myboundary"; @Test - public void testSmallBuffer() { + void testSmallBuffer() { final var strData = "foobar"; final var contents = strData.getBytes(); final InputStream input = new ByteArrayInputStream(contents); @@ -43,7 +43,7 @@ public class MultipartStreamTest { } @Test - public void testThreeParamConstructor() throws Exception { + void testThreeParamConstructor() throws Exception { final var strData = "foobar"; final var contents = strData.getBytes(); final InputStream input = new ByteArrayInputStream(contents); @@ -55,7 +55,7 @@ public class MultipartStreamTest { } @Test - public void testTwoParamConstructor() throws Exception { + void testTwoParamConstructor() throws Exception { final var strData = "foobar"; final var contents = strData.getBytes(); final InputStream input = new ByteArrayInputStream(contents); diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/ParameterParserTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/ParameterParserTest.java index 4b1f6fc9..159ad778 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/ParameterParserTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/ParameterParserTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; public class ParameterParserTest { @Test - public void testContentTypeParsing() { + void testContentTypeParsing() { final var s = "text/plain; Charset=UTF-8"; final var parser = new ParameterParser(); parser.setLowerCaseNames(true); @@ -39,7 +39,7 @@ public class ParameterParserTest { // See: https://issues.apache.org/jira/browse/FILEUPLOAD-139 @Test - public void testFileUpload139() { + void testFileUpload139() { final var parser = new ParameterParser(); var s = "Content-type: multipart/form-data , boundary=AaB03x"; var params = parser.parse(s, new char[] { ',', ';' }); @@ -58,7 +58,7 @@ public class ParameterParserTest { * Test for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-199">FILEUPLOAD-199</a> */ @Test - public void testFileUpload199() { + void testFileUpload199() { final var parser = new ParameterParser(); final var s = "Content-Disposition: form-data; name=\"file\"; filename=\"=?ISO-8859-" + "1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n"; @@ -70,7 +70,7 @@ public class ParameterParserTest { * Test for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-274">FILEUPLOAD-274</a> */ @Test - public void testFileUpload274() { + void testFileUpload274() { final var parser = new ParameterParser(); // Should parse a UTF-8 charset @@ -100,7 +100,7 @@ public class ParameterParserTest { } @Test - public void testParsing() { + void testParsing() { var s = "test; test1 = stuff ; test2 = \"stuff; stuff\"; test3=\"stuff"; final var parser = new ParameterParser(); var params = parser.parse(s, ';'); @@ -136,7 +136,7 @@ public class ParameterParserTest { } @Test - public void testParsingEscapedChars() { + void testParsingEscapedChars() { var s = "param = \"stuff\\\"; more stuff\""; final var parser = new ParameterParser(); var params = parser.parse(s, ';'); diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/QuotedPrintableDecoderTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/QuotedPrintableDecoderTestCase.java index d633e1dd..12d66909 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/QuotedPrintableDecoderTestCase.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/QuotedPrintableDecoderTestCase.java @@ -55,37 +55,37 @@ public final class QuotedPrintableDecoderTestCase { } @Test - public void testBasicEncodeDecode() throws Exception { + void testBasicEncodeDecode() throws Exception { assertEncoded("= Hello there =\r\n", "=3D Hello there =3D=0D=0A"); } @Test - public void testEmptyDecode() throws Exception { + void testEmptyDecode() throws Exception { assertEncoded("", ""); } @Test - public void testInvalidCharDecode() { + void testInvalidCharDecode() { assertThrows(IOException.class, () -> assertEncoded("=\r\n", "=3D=XD=XA")); } @Test - public void testInvalidQuotedPrintableEncoding() throws Exception { + void testInvalidQuotedPrintableEncoding() throws Exception { assertIOException("truncated escape sequence", "YWJjMTIzXy0uKn4hQCMkJV4mKCkre31cIlxcOzpgLC9bXQ=="); } @Test - public void testInvalidSoftBreak1() throws Exception { + void testInvalidSoftBreak1() throws Exception { assertIOException("CR must be followed by LF", "=\r\r"); } @Test - public void testInvalidSoftBreak2() throws Exception { + void testInvalidSoftBreak2() throws Exception { assertIOException("CR must be followed by LF", "=\rn"); } @Test - public void testPlainDecode() throws Exception { + void testPlainDecode() throws Exception { // spaces are allowed in encoded data // There are special rules for trailing spaces; these are not currently implemented. assertEncoded("The quick brown fox jumps over the lazy dog.", "The quick brown fox jumps over the lazy dog."); @@ -98,23 +98,23 @@ public final class QuotedPrintableDecoderTestCase { * @see <a href="https://issues.apache.org/jira/browse/CODEC-121">CODEC-121</a> */ @Test - public void testSoftLineBreakDecode() throws Exception { + void testSoftLineBreakDecode() throws Exception { assertEncoded("If you believe that truth=beauty, then surely mathematics is the most " + "beautiful branch of philosophy.", "If you believe that truth=3Dbeauty, then " + "surely=20=\r\nmathematics is the most beautiful branch of philosophy."); } @Test - public void testTruncatedEscape() throws Exception { + void testTruncatedEscape() throws Exception { assertIOException("truncated", "=1"); } @Test - public void testUnsafeDecode() throws Exception { + void testUnsafeDecode() throws Exception { assertEncoded("=\r\n", "=3D=0D=0A"); } @Test - public void testUnsafeDecodeLowerCase() throws Exception { + void testUnsafeDecodeLowerCase() throws Exception { assertEncoded("=\r\n", "=3d=0d=0a"); } diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java index 966226cf..b4356e55 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java @@ -37,22 +37,22 @@ public final class RFC2231UtilityTestCase { } @Test - public void testDecodeInvalidEncoding() throws Exception { + void testDecodeInvalidEncoding() throws Exception { assertThrows(UnsupportedEncodingException.class, () -> RFC2231Utils.decodeText("abc'en'hello")); } @Test - public void testDecodeIso88591() throws Exception { + void testDecodeIso88591() throws Exception { assertEncoded("\u00A3 rate", "iso-8859-1'en'%A3%20rate"); // "£ rate" } @Test - public void testDecodeUtf8() throws Exception { + void testDecodeUtf8() throws Exception { assertEncoded("\u00a3 \u0061\u006e\u0064 \u20ac \u0072\u0061\u0074\u0065\u0073", "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates"); // "£ and € rates" } @Test - public void testHasEncodedValue() { + void testHasEncodedValue() { final var nameWithAsteriskAtEnd = "paramname*"; assertTrue(RFC2231Utils.hasEncodedValue(nameWithAsteriskAtEnd)); @@ -64,12 +64,12 @@ public final class RFC2231UtilityTestCase { } @Test - public void testNoNeedToDecode() throws Exception { + void testNoNeedToDecode() throws Exception { assertEncoded("abc", "abc"); } @Test - public void testStripDelimiter() { + void testStripDelimiter() { final var nameWithAsteriskAtEnd = "paramname*"; assertEquals("paramname", RFC2231Utils.stripDelimiter(nameWithAsteriskAtEnd)); diff --git a/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadDiskTest.java b/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadDiskTest.java index 5c3562d7..70b97cb0 100644 --- a/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadDiskTest.java +++ b/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadDiskTest.java @@ -50,7 +50,7 @@ public class JakartaServletFileUploadDiskTest } @Test - public void testParseImpliedUtf8() throws Exception { + void testParseImpliedUtf8() throws Exception { // utf8 encoded form-data without explicit content-type encoding // @formatter:off final var text = "-----1234\r\n" + @@ -78,7 +78,7 @@ public class JakartaServletFileUploadDiskTest * Test case for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-210"> */ @Test - public void testParseParameterMap() throws Exception { + void testParseParameterMap() throws Exception { // @formatter:off final var text = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" + diff --git a/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadTest.java b/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadTest.java index cd0baa58..3255913d 100644 --- a/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadTest.java +++ b/commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadTest.java @@ -52,7 +52,7 @@ public class JakartaServletFileUploadTest } @Test - public void testParseImpliedUtf8() throws Exception { + void testParseImpliedUtf8() throws Exception { // utf8 encoded form-data without explicit content-type encoding // @formatter:off final var text = "-----1234\r\n" + @@ -80,7 +80,7 @@ public class JakartaServletFileUploadTest * Test case for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-210"> */ @Test - public void testParseParameterMap() throws Exception { + void testParseParameterMap() throws Exception { // @formatter:off final var text = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" + diff --git a/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadDiskTest.java b/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadDiskTest.java index 3139c671..a692f9fe 100644 --- a/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadDiskTest.java +++ b/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadDiskTest.java @@ -50,7 +50,7 @@ public class JakartaServletFileUploadDiskTest } @Test - public void testParseImpliedUtf8() throws Exception { + void testParseImpliedUtf8() throws Exception { // utf8 encoded form-data without explicit content-type encoding // @formatter:off final var text = "-----1234\r\n" + @@ -78,7 +78,7 @@ public class JakartaServletFileUploadDiskTest * Test case for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-210"> */ @Test - public void testParseParameterMap() throws Exception { + void testParseParameterMap() throws Exception { // @formatter:off final var text = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" + diff --git a/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadTest.java b/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadTest.java index 311960f2..d2177416 100644 --- a/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadTest.java +++ b/commons-fileupload2-jakarta-servlet6/src/test/java/org/apache/commons/fileupload2/jakarta/servlet6/JakartaServletFileUploadTest.java @@ -51,7 +51,7 @@ public class JakartaServletFileUploadTest } @Test - public void testParseImpliedUtf8() throws Exception { + void testParseImpliedUtf8() throws Exception { // utf8 encoded form-data without explicit content-type encoding // @formatter:off final var text = "-----1234\r\n" + @@ -79,7 +79,7 @@ public class JakartaServletFileUploadTest * Test case for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-210"> */ @Test - public void testParseParameterMap() throws Exception { + void testParseParameterMap() throws Exception { // @formatter:off final var text = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" + diff --git a/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadDiskTest.java b/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadDiskTest.java index 5a6a84d9..0c5d18cf 100644 --- a/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadDiskTest.java +++ b/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadDiskTest.java @@ -56,7 +56,7 @@ public class JavaxServletFileUploadDiskTest extends AbstractFileUploadTest<Javax */ @Override @Test - public void testFileUpload() throws IOException, FileUploadException { + void testFileUpload() throws IOException, FileUploadException { final var baos = new ByteArrayOutputStream(); var add = 16; var num = 0; @@ -93,7 +93,7 @@ public class JavaxServletFileUploadDiskTest extends AbstractFileUploadTest<Javax } @Test - public void testParseImpliedUtf8() throws Exception { + void testParseImpliedUtf8() throws Exception { // utf8 encoded form-data without explicit content-type encoding // @formatter:off final var text = "-----1234\r\n" + @@ -121,7 +121,7 @@ public class JavaxServletFileUploadDiskTest extends AbstractFileUploadTest<Javax * Test case for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-210"> */ @Test - public void testParseParameterMap() throws Exception { + void testParseParameterMap() throws Exception { // @formatter:off final var text = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" + diff --git a/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java b/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java index 28aaab62..49daf915 100644 --- a/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java +++ b/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java @@ -95,7 +95,7 @@ public class JavaxServletFileUploadTest } @Test - public void testParseImpliedUtf8() throws Exception { + void testParseImpliedUtf8() throws Exception { // utf8 encoded form-data without explicit content-type encoding // @formatter:off final var text = "-----1234\r\n" + @@ -123,7 +123,7 @@ public class JavaxServletFileUploadTest * Test case for <a href="https://issues.apache.org/jira/browse/FILEUPLOAD-210"> */ @Test - public void testParseParameterMap() throws Exception { + void testParseParameterMap() throws Exception { // @formatter:off final var text = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" + diff --git a/commons-fileupload2-portlet/src/test/java/org/apache/commons/fileupload2/portlet/JavaxPortletFileUploadTest.java b/commons-fileupload2-portlet/src/test/java/org/apache/commons/fileupload2/portlet/JavaxPortletFileUploadTest.java index 3b9baa86..2534ed8c 100644 --- a/commons-fileupload2-portlet/src/test/java/org/apache/commons/fileupload2/portlet/JavaxPortletFileUploadTest.java +++ b/commons-fileupload2-portlet/src/test/java/org/apache/commons/fileupload2/portlet/JavaxPortletFileUploadTest.java @@ -51,7 +51,7 @@ public class JavaxPortletFileUploadTest } @Test - public void testParseParameterMap() throws Exception { + void testParseParameterMap() throws Exception { // @formatter:off final var text = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" +