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-io.git
commit 59b3601ef62d28378b654e3f8a35d89a219c86c2 Author: Gary Gregory <[email protected]> AuthorDate: Fri Nov 3 11:00:30 2023 -0400 Normalize test method names --- .../java/org/apache/commons/io/CopyUtilsTest.java | 16 ++++----- .../io/FileUtilsCopyDirectoryToDirectoryTest.java | 10 +++--- .../io/comparator/CompositeFileComparatorTest.java | 6 ++-- .../commons/io/filefilter/AndFileFilterTest.java | 2 +- .../commons/io/input/BOMInputStreamTest.java | 4 +-- .../apache/commons/io/input/BoundedReaderTest.java | 22 ++++++------ .../io/input/MarkShieldInputStreamTest.java | 12 +++---- .../io/input/UnixLineEndingInputStreamTest.java | 14 ++++---- .../io/input/WindowsLineEndingInputStreamTest.java | 12 +++---- .../commons/io/output/ChunkedWriterTest.java | 6 ++-- .../io/output/FileWriterWithEncodingTest.java | 30 ++++++++-------- .../apache/commons/io/output/ProxyWriterTest.java | 42 +++++++++++----------- .../commons/io/output/QueueOutputStreamTest.java | 6 ++-- .../io/serialization/FullClassNameMatcherTest.java | 4 +-- .../io/serialization/MoreComplexObjectTest.java | 2 +- .../ValidatingObjectInputStreamTest.java | 36 +++++++++---------- .../WildcardClassNameMatcherTest.java | 6 ++-- 17 files changed, 115 insertions(+), 115 deletions(-) diff --git a/src/test/java/org/apache/commons/io/CopyUtilsTest.java b/src/test/java/org/apache/commons/io/CopyUtilsTest.java index e0bab26a..76b87541 100644 --- a/src/test/java/org/apache/commons/io/CopyUtilsTest.java +++ b/src/test/java/org/apache/commons/io/CopyUtilsTest.java @@ -55,7 +55,7 @@ public class CopyUtilsTest { private final byte[] inData = TestUtils.generateTestData(FILE_SIZE); @Test - public void copy_byteArrayToOutputStream() throws Exception { + public void testCopy_byteArrayToOutputStream() throws Exception { final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new ThrowOnFlushAndCloseOutputStream(baout, false, true); @@ -66,7 +66,7 @@ public class CopyUtilsTest { } @Test - public void copy_byteArrayToWriter() throws Exception { + public void testCopy_byteArrayToWriter() throws Exception { final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new ThrowOnFlushAndCloseOutputStream(baout, false, true); final Writer writer = new java.io.OutputStreamWriter(out, StandardCharsets.US_ASCII); @@ -80,7 +80,7 @@ public class CopyUtilsTest { @SuppressWarnings("resource") // 'in' is deliberately not closed @Test - public void copy_inputStreamToWriter() throws Exception { + public void testCopy_inputStreamToWriter() throws Exception { InputStream in = new ByteArrayInputStream(inData); in = new ThrowOnCloseInputStream(in); @@ -97,7 +97,7 @@ public class CopyUtilsTest { } @Test - public void copy_inputStreamToWriterWithEncoding() throws Exception { + public void testCopy_inputStreamToWriterWithEncoding() throws Exception { final String inDataStr = "data"; final String charsetName = StandardCharsets.UTF_8.name(); final StringWriter writer = new StringWriter(); @@ -107,7 +107,7 @@ public class CopyUtilsTest { @SuppressWarnings("resource") // 'in' is deliberately not closed @Test - public void copy_readerToWriter() throws Exception { + public void testCopy_readerToWriter() throws Exception { InputStream in = new ByteArrayInputStream(inData); in = new ThrowOnCloseInputStream(in); final Reader reader = new java.io.InputStreamReader(in, StandardCharsets.US_ASCII); @@ -124,7 +124,7 @@ public class CopyUtilsTest { } @Test - public void copy_stringToOutputStream() throws Exception { + public void testCopy_stringToOutputStream() throws Exception { final String str = new String(inData, StandardCharsets.US_ASCII); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); @@ -143,7 +143,7 @@ public class CopyUtilsTest { } @Test - public void copy_stringToOutputStreamString() throws Exception { + public void testCopy_stringToOutputStreamString() throws Exception { final String str = new String(inData, StandardCharsets.US_ASCII); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); @@ -162,7 +162,7 @@ public class CopyUtilsTest { } @Test - public void copy_stringToWriter() throws Exception { + public void testCopy_stringToWriter() throws Exception { final String str = new String(inData, StandardCharsets.US_ASCII); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); diff --git a/src/test/java/org/apache/commons/io/FileUtilsCopyDirectoryToDirectoryTest.java b/src/test/java/org/apache/commons/io/FileUtilsCopyDirectoryToDirectoryTest.java index 6bc2223e..e4032f86 100644 --- a/src/test/java/org/apache/commons/io/FileUtilsCopyDirectoryToDirectoryTest.java +++ b/src/test/java/org/apache/commons/io/FileUtilsCopyDirectoryToDirectoryTest.java @@ -60,7 +60,7 @@ public class FileUtilsCopyDirectoryToDirectoryTest { } @Test - public void copyDirectoryToDirectoryThrowsIllegalArgumentExceptionWithCorrectMessageWhenDstDirIsNotDirectory() + public void testCopyDirectoryToDirectoryThrowsIllegalArgumentExceptionWithCorrectMessageWhenDstDirIsNotDirectory() throws IOException { final File srcDir = new File(temporaryFolder, "sourceDirectory"); srcDir.mkdir(); @@ -72,7 +72,7 @@ public class FileUtilsCopyDirectoryToDirectoryTest { } @Test - public void copyDirectoryToDirectoryThrowsIllegalExceptionWithCorrectMessageWhenSrcDirIsNotDirectory() + public void testCopyDirectoryToDirectoryThrowsIllegalExceptionWithCorrectMessageWhenSrcDirIsNotDirectory() throws IOException { try (TempFile srcDir = TempFile.create("notadirectory", null)) { final File destDir = new File(temporaryFolder, "destinationDirectory"); @@ -83,7 +83,7 @@ public class FileUtilsCopyDirectoryToDirectoryTest { } @Test - public void copyDirectoryToDirectoryThrowsNullPointerExceptionWithCorrectMessageWhenDstDirIsNull() { + public void testCopyDirectoryToDirectoryThrowsNullPointerExceptionWithCorrectMessageWhenDstDirIsNull() { final File srcDir = new File(temporaryFolder, "sourceDirectory"); srcDir.mkdir(); final File destDir = null; @@ -91,7 +91,7 @@ public class FileUtilsCopyDirectoryToDirectoryTest { } @Test - public void copyDirectoryToDirectoryThrowsNullPointerExceptionWithCorrectMessageWhenSrcDirIsNull() { + public void testCopyDirectoryToDirectoryThrowsNullPointerExceptionWithCorrectMessageWhenSrcDirIsNull() { final File srcDir = null; final File destinationDirectory = new File(temporaryFolder, "destinationDirectory"); destinationDirectory.mkdir(); @@ -99,7 +99,7 @@ public class FileUtilsCopyDirectoryToDirectoryTest { } @Test - public void copyFileAndCheckAcl() throws IOException { + public void testCopyFileAndCheckAcl() throws IOException { try (TempFile sourcePath = TempFile.create("TempOutput", ".bin")) { final Path destPath = Paths.get(temporaryFolder.getAbsolutePath(), "SomeFile.bin"); // Test copy attributes without replace FIRST. diff --git a/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java b/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java index 79a7c0a7..50f2a2d3 100644 --- a/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java +++ b/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java @@ -40,7 +40,7 @@ public class CompositeFileComparatorTest extends ComparatorAbstractTest { * Test Constructor with null array */ @Test - public void constructorArray_Null() { + public void testConstructorArray_Null() { final Comparator<File> c = new CompositeFileComparator((Comparator<File>[]) null); assertEquals(0, c.compare(lessFile, moreFile), "less,more"); assertEquals(0, c.compare(moreFile, lessFile), "more,less"); @@ -51,7 +51,7 @@ public class CompositeFileComparatorTest extends ComparatorAbstractTest { * Test Constructor with null Iterable */ @Test - public void constructorIterable_Null() { + public void testConstructorIterable_Null() { final Comparator<File> c = new CompositeFileComparator((Iterable<Comparator<File>>) null); assertEquals(0, c.compare(lessFile, moreFile), "less,more"); assertEquals(0, c.compare(moreFile, lessFile), "more,less"); @@ -62,7 +62,7 @@ public class CompositeFileComparatorTest extends ComparatorAbstractTest { * Test Constructor with null Iterable */ @Test - public void constructorIterable_order() { + public void testConstructorIterable_order() { final List<Comparator<File>> list = new ArrayList<>(); list.add(SizeFileComparator.SIZE_COMPARATOR); list.add(ExtensionFileComparator.EXTENSION_COMPARATOR); diff --git a/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTest.java b/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTest.java index 3dffd9a2..aabc5ea3 100644 --- a/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTest.java +++ b/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTest.java @@ -92,7 +92,7 @@ public class AndFileFilterTest extends AbstractConditionalFileFilterTest { } @Test - public void setTestFiltersClearsOld() { + public void testSetTestFiltersClearsOld() { // test that new filters correctly clear old filters final List<IOFileFilter> simpleEmptyFileFilter = Collections.singletonList(EmptyFileFilter.EMPTY); final AndFileFilter andFileFilter = new AndFileFilter(simpleEmptyFileFilter); diff --git a/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java b/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java index 9ce5d54e..6d524f15 100644 --- a/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java @@ -206,7 +206,7 @@ public class BOMInputStreamTest { } @Test - public void skipReturnValueWithBom() throws IOException { + public void testSkipReturnValueWithBom() throws IOException { final byte[] data = { (byte) 0x31, (byte) 0x32, (byte) 0x33 }; try (BOMInputStream is1 = BOMInputStream.builder().setInputStream(createUtf8Input(data, true)).get()) { assertEquals(2, is1.skip(2)); @@ -215,7 +215,7 @@ public class BOMInputStreamTest { } @Test - public void skipReturnValueWithoutBom() throws IOException { + public void testSkipReturnValueWithoutBom() throws IOException { final byte[] data = { (byte) 0x31, (byte) 0x32, (byte) 0x33 }; try (BOMInputStream is2 = BOMInputStream.builder().setInputStream(createUtf8Input(data, false)).get()) { assertEquals(2, is2.skip(2)); // IO-428 diff --git a/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java b/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java index 41204391..13ae5af9 100644 --- a/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java +++ b/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java @@ -54,7 +54,7 @@ public class BoundedReaderTest { private final Reader shortReader = new BufferedReader(new StringReader("01")); @Test - public void closeTest() throws IOException { + public void testCloseTest() throws IOException { final AtomicBoolean closed = new AtomicBoolean(false); try (Reader sr = new BufferedReader(new StringReader("01234567890")) { @Override @@ -72,7 +72,7 @@ public class BoundedReaderTest { } @Test - public void markReset() throws IOException { + public void testMarkReset() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { mr.mark(3); mr.read(); @@ -87,7 +87,7 @@ public class BoundedReaderTest { } @Test - public void markResetFromOffset1() throws IOException { + public void testMarkResetFromOffset1() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { mr.mark(3); mr.read(); @@ -102,7 +102,7 @@ public class BoundedReaderTest { } @Test - public void markResetMarkMore() throws IOException { + public void testMarkResetMarkMore() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { mr.mark(4); mr.read(); @@ -117,7 +117,7 @@ public class BoundedReaderTest { } @Test - public void markResetWithMarkOutsideBoundedReaderMax() throws IOException { + public void testMarkResetWithMarkOutsideBoundedReaderMax() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { mr.mark(4); mr.read(); @@ -128,7 +128,7 @@ public class BoundedReaderTest { } @Test - public void markResetWithMarkOutsideBoundedReaderMaxAndInitialOffset() throws IOException { + public void testMarkResetWithMarkOutsideBoundedReaderMaxAndInitialOffset() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { mr.read(); mr.mark(3); @@ -139,7 +139,7 @@ public class BoundedReaderTest { } @Test - public void readMulti() throws IOException { + public void testReadMulti() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { final char[] cbuf = new char[4]; Arrays.fill(cbuf, 'X'); @@ -153,7 +153,7 @@ public class BoundedReaderTest { } @Test - public void readMultiWithOffset() throws IOException { + public void testReadMultiWithOffset() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { final char[] cbuf = new char[4]; Arrays.fill(cbuf, 'X'); @@ -167,7 +167,7 @@ public class BoundedReaderTest { } @Test - public void readTillEnd() throws IOException { + public void testReadTillEnd() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { mr.read(); mr.read(); @@ -177,7 +177,7 @@ public class BoundedReaderTest { } @Test - public void shortReader() throws IOException { + public void testShortReader() throws IOException { try (BoundedReader mr = new BoundedReader(shortReader, 3)) { mr.read(); mr.read(); @@ -186,7 +186,7 @@ public class BoundedReaderTest { } @Test - public void skipTest() throws IOException { + public void testSkipTest() throws IOException { try (BoundedReader mr = new BoundedReader(sr, 3)) { mr.skip(2); mr.read(); diff --git a/src/test/java/org/apache/commons/io/input/MarkShieldInputStreamTest.java b/src/test/java/org/apache/commons/io/input/MarkShieldInputStreamTest.java index e82c3341..2862bb0d 100644 --- a/src/test/java/org/apache/commons/io/input/MarkShieldInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/MarkShieldInputStreamTest.java @@ -49,7 +49,7 @@ public class MarkShieldInputStreamTest { } @Test - public void markIsNoOpWhenUnderlyingDoesNotSupport() throws IOException { + public void testMarkIsNoOpWhenUnderlyingDoesNotSupport() throws IOException { try (MarkTestableInputStream in = new MarkTestableInputStream(new NullInputStream(64, false, false)); final MarkShieldInputStream msis = new MarkShieldInputStream(in)) { @@ -61,7 +61,7 @@ public class MarkShieldInputStreamTest { } @Test - public void markIsNoOpWhenUnderlyingSupports() throws IOException { + public void testMarkIsNoOpWhenUnderlyingSupports() throws IOException { try (MarkTestableInputStream in = new MarkTestableInputStream(new NullInputStream(64, true, false)); final MarkShieldInputStream msis = new MarkShieldInputStream(in)) { @@ -73,7 +73,7 @@ public class MarkShieldInputStreamTest { } @Test - public void markSupportedIsFalseWhenUnderlyingFalse() throws IOException { + public void testMarkSupportedIsFalseWhenUnderlyingFalse() throws IOException { // test wrapping an underlying stream which does NOT support marking try (InputStream is = new NullInputStream(64, false, false)) { assertFalse(is.markSupported()); @@ -85,7 +85,7 @@ public class MarkShieldInputStreamTest { } @Test - public void markSupportedIsFalseWhenUnderlyingTrue() throws IOException { + public void testMarkSupportedIsFalseWhenUnderlyingTrue() throws IOException { // test wrapping an underlying stream which supports marking try (InputStream is = new NullInputStream(64, true, false)) { assertTrue(is.markSupported()); @@ -97,7 +97,7 @@ public class MarkShieldInputStreamTest { } @Test - public void resetThrowsExceptionWhenUnderlyingDoesNotSupport() throws IOException { + public void testResetThrowsExceptionWhenUnderlyingDoesNotSupport() throws IOException { // test wrapping an underlying stream which does NOT support marking try (MarkShieldInputStream msis = new MarkShieldInputStream( new NullInputStream(64, false, false))) { @@ -106,7 +106,7 @@ public class MarkShieldInputStreamTest { } @Test - public void resetThrowsExceptionWhenUnderlyingSupports() throws IOException { + public void testResetThrowsExceptionWhenUnderlyingSupports() throws IOException { // test wrapping an underlying stream which supports marking try (MarkShieldInputStream msis = new MarkShieldInputStream( new NullInputStream(64, true, false))) { diff --git a/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java b/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java index 66f06964..9c1ac1ea 100644 --- a/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java @@ -27,32 +27,32 @@ import org.junit.jupiter.api.Test; public class UnixLineEndingInputStreamTest { @Test - public void crAtEnd() throws Exception { + public void testCrAtEnd() throws Exception { assertEquals("a\n", roundtrip("a\r")); } @Test - public void crOnlyEnsureAtEof() throws Exception { + public void testCrOnlyEnsureAtEof() throws Exception { assertEquals("a\nb\n", roundtrip("a\rb")); } @Test - public void crOnlyNotAtEof() throws Exception { + public void testCrOnlyNotAtEof() throws Exception { assertEquals("a\nb", roundtrip("a\rb", false)); } @Test - public void inTheMiddleOfTheLine() throws Exception { + public void testInTheMiddleOfTheLine() throws Exception { assertEquals("a\nbc\n", roundtrip("a\r\nbc")); } @Test - public void multipleBlankLines() throws Exception { + public void testMultipleBlankLines() throws Exception { assertEquals("a\n\nbc\n", roundtrip("a\r\n\r\nbc")); } @Test - public void retainLineFeed() throws Exception { + public void testRetainLineFeed() throws Exception { assertEquals("a\n\n", roundtrip("a\r\n\r\n", false)); assertEquals("a", roundtrip("a", false)); } @@ -70,7 +70,7 @@ public class UnixLineEndingInputStreamTest { } @Test - public void simpleString() throws Exception { + public void testSimpleString() throws Exception { assertEquals("abc\n", roundtrip("abc")); } diff --git a/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java b/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java index 81d17fa1..e82edb9c 100644 --- a/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java @@ -25,28 +25,28 @@ import org.junit.jupiter.api.Test; public class WindowsLineEndingInputStreamTest { @Test - public void inTheMiddleOfTheLine() throws Exception { + public void testInTheMiddleOfTheLine() throws Exception { assertEquals("a\r\nbc\r\n", roundtrip("a\r\nbc")); } @Test - public void linuxLineFeeds() throws Exception { + public void testLinuxLineFeeds() throws Exception { final String roundtrip = roundtrip("ab\nc", false); assertEquals("ab\r\nc", roundtrip); } @Test - public void malformed() throws Exception { + public void testMalformed() throws Exception { assertEquals("a\rbc", roundtrip("a\rbc", false)); } @Test - public void multipleBlankLines() throws Exception { + public void testMultipleBlankLines() throws Exception { assertEquals("a\r\n\r\nbc\r\n", roundtrip("a\r\n\r\nbc")); } @Test - public void retainLineFeed() throws Exception { + public void testRetainLineFeed() throws Exception { assertEquals("a\r\n\r\n", roundtrip("a\r\n\r\n", false)); assertEquals("a", roundtrip("a", false)); } @@ -65,7 +65,7 @@ public class WindowsLineEndingInputStreamTest { } @Test - public void simpleString() throws Exception { + public void testSimpleString() throws Exception { assertEquals("abc\r\n", roundtrip("abc")); } diff --git a/src/test/java/org/apache/commons/io/output/ChunkedWriterTest.java b/src/test/java/org/apache/commons/io/output/ChunkedWriterTest.java index 534030d6..60445e7e 100644 --- a/src/test/java/org/apache/commons/io/output/ChunkedWriterTest.java +++ b/src/test/java/org/apache/commons/io/output/ChunkedWriterTest.java @@ -44,13 +44,13 @@ public class ChunkedWriterTest { } @Test - public void negative_chunkSize_not_permitted() { + public void testNegative_chunkSize_not_permitted() { assertThrows(IllegalArgumentException.class, () -> new ChunkedWriter(new OutputStreamWriter(new ByteArrayOutputStream()), 0)); } @Test - public void write_four_chunks() throws Exception { + public void testWrite_four_chunks() throws Exception { final AtomicInteger numWrites = new AtomicInteger(); try (OutputStreamWriter osw = getOutputStreamWriter(numWrites)) { try (ChunkedWriter chunked = new ChunkedWriter(osw, 10)) { @@ -62,7 +62,7 @@ public class ChunkedWriterTest { } @Test - public void write_two_chunks_default_constructor() throws Exception { + public void testWrite_two_chunks_default_constructor() throws Exception { final AtomicInteger numWrites = new AtomicInteger(); try (OutputStreamWriter osw = getOutputStreamWriter(numWrites)) { try (ChunkedWriter chunked = new ChunkedWriter(osw)) { diff --git a/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java b/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java index b6a009fb..22a26a82 100644 --- a/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java +++ b/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java @@ -52,7 +52,7 @@ public class FileWriterWithEncodingTest { private final char[] anotherTestContent = {'f', 'z', 'x'}; @Test - public void constructor_File_directory() { + public void testConstructor_File_directory() { assertThrows(IOException.class, () -> { try (Writer writer = new FileWriterWithEncoding(temporaryFolder, defaultEncoding)) { // empty @@ -68,7 +68,7 @@ public class FileWriterWithEncodingTest { } @Test - public void constructor_File_encoding_badEncoding() { + public void testConstructor_File_encoding_badEncoding() { assertThrows(IOException.class, () -> { try (Writer writer = new FileWriterWithEncoding(file1, "BAD-ENCODE")) { // empty @@ -78,7 +78,7 @@ public class FileWriterWithEncodingTest { } @Test - public void constructor_File_existingFile_withContent() throws Exception { + public void testConstructor_File_existingFile_withContent() throws Exception { try (FileWriter fw1 = new FileWriter(file1);) { fw1.write(textContent); fw1.write(65); @@ -99,7 +99,7 @@ public class FileWriterWithEncodingTest { } @Test - public void constructor_File_nullFile() { + public void testConstructor_File_nullFile() { assertThrows(NullPointerException.class, () -> { try (Writer writer = new FileWriterWithEncoding((File) null, defaultEncoding)) { // empty @@ -109,7 +109,7 @@ public class FileWriterWithEncodingTest { } @Test - public void constructor_fileName_nullFile() { + public void testConstructor_fileName_nullFile() { assertThrows(NullPointerException.class, () -> { try (Writer writer = new FileWriterWithEncoding((String) null, defaultEncoding)) { // empty @@ -119,7 +119,7 @@ public class FileWriterWithEncodingTest { } @Test - public void constructorAppend_File_existingFile_withContent() throws Exception { + public void testConstructorAppend_File_existingFile_withContent() throws Exception { try (FileWriter fw1 = new FileWriter(file1)) { fw1.write("ABcd"); } @@ -145,7 +145,7 @@ public class FileWriterWithEncodingTest { } @Test - public void sameEncoding_Charset_constructor() throws Exception { + public void testSameEncoding_Charset_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2, Charset.defaultCharset())) { successfulRun(writer); } @@ -160,7 +160,7 @@ public class FileWriterWithEncodingTest { } @Test - public void sameEncoding_CharsetEncoder_constructor() throws Exception { + public void testSameEncoding_CharsetEncoder_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2, Charset.defaultCharset().newEncoder())) { successfulRun(writer); } @@ -175,14 +175,14 @@ public class FileWriterWithEncodingTest { } @Test - public void sameEncoding_null_Charset_constructor() throws Exception { + public void testSameEncoding_null_Charset_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2, (Charset) null)) { successfulRun(writer); } } @Test - public void sameEncoding_null_CharsetEncoder_constructor() throws Exception { + public void testSameEncoding_null_CharsetEncoder_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2.getPath(), (CharsetEncoder) null)) { successfulRun(writer); } @@ -195,14 +195,14 @@ public class FileWriterWithEncodingTest { } @Test - public void sameEncoding_null_CharsetName_constructor() throws Exception { + public void testSameEncoding_null_CharsetName_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2.getPath(), (String) null)) { successfulRun(writer); } } @Test - public void sameEncoding_string_Charset_constructor() throws Exception { + public void testSameEncoding_string_Charset_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2.getPath(), Charset.defaultCharset())) { successfulRun(writer); } @@ -217,21 +217,21 @@ public class FileWriterWithEncodingTest { } @Test - public void sameEncoding_string_CharsetEncoder_constructor() throws Exception { + public void testSameEncoding_string_CharsetEncoder_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2.getPath(), Charset.defaultCharset().newEncoder())) { successfulRun(writer); } } @Test - public void sameEncoding_string_constructor() throws Exception { + public void testSameEncoding_string_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2, defaultEncoding)) { successfulRun(writer); } } @Test - public void sameEncoding_string_string_constructor() throws Exception { + public void testSameEncoding_string_string_constructor() throws Exception { try (FileWriterWithEncoding writer = new FileWriterWithEncoding(file2.getPath(), defaultEncoding)) { successfulRun(writer); } diff --git a/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java b/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java index 0bcee12a..a69d4d54 100644 --- a/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java +++ b/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java @@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test; public class ProxyWriterTest { @Test - public void appendChar() throws Exception { + public void testAppendChar() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.append('c'); @@ -41,7 +41,7 @@ public class ProxyWriterTest { } @Test - public void appendCharSequence() throws Exception { + public void testAppendCharSequence() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.append("ABC"); @@ -50,7 +50,7 @@ public class ProxyWriterTest { } @Test - public void appendCharSequence_with_offset() throws Exception { + public void testAppendCharSequence_with_offset() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.append("ABC", 1, 3); @@ -60,7 +60,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_append_char() throws IOException { + public void testExceptions_in_append_char() throws IOException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); final OutputStreamWriter osw = new OutputStreamWriter(baos) { @Override @@ -75,7 +75,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_append_charSequence() throws IOException { + public void testExceptions_in_append_charSequence() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public Writer append(final CharSequence csq) throws IOException { @@ -89,7 +89,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_append_charSequence_offset() throws IOException { + public void testExceptions_in_append_charSequence_offset() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public Writer append(final CharSequence csq, final int start, final int end) throws IOException { @@ -103,7 +103,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_close() { + public void testExceptions_in_close() { assertThrows(UnsupportedEncodingException.class, () -> { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override @@ -119,7 +119,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_flush() throws IOException { + public void testExceptions_in_flush() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void flush() throws IOException { @@ -133,7 +133,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_write_char_array() throws IOException { + public void testExceptions_in_write_char_array() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void write(final char[] cbuf) throws IOException { @@ -147,7 +147,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_write_int() throws IOException { + public void testExceptions_in_write_int() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void write(final int c) throws IOException { @@ -161,7 +161,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_write_offset_char_array() throws IOException { + public void testExceptions_in_write_offset_char_array() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void write(final char[] cbuf, final int off, final int len) throws IOException { @@ -175,7 +175,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_write_string() throws IOException { + public void testExceptions_in_write_string() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void write(final String str) throws IOException { @@ -189,7 +189,7 @@ public class ProxyWriterTest { } @Test - public void exceptions_in_write_string_offset() throws IOException { + public void testExceptions_in_write_string_offset() throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void write(final String str, final int off, final int len) throws IOException { @@ -203,7 +203,7 @@ public class ProxyWriterTest { } @Test - public void nullCharArray() throws Exception { + public void testNullCharArray() throws Exception { try (ProxyWriter proxy = new ProxyWriter(NullWriter.INSTANCE)) { proxy.write((char[]) null); proxy.write((char[]) null, 0, 0); @@ -211,14 +211,14 @@ public class ProxyWriterTest { } @Test - public void nullCharSequence() throws Exception { + public void testNullCharSequence() throws Exception { try (ProxyWriter proxy = new ProxyWriter(NullWriter.INSTANCE)) { proxy.append(null); } } @Test - public void nullString() throws Exception { + public void testNullString() throws Exception { try (ProxyWriter proxy = new ProxyWriter(NullWriter.INSTANCE)) { proxy.write((String) null); proxy.write((String) null, 0, 0); @@ -226,7 +226,7 @@ public class ProxyWriterTest { } @Test - public void writeCharArray() throws Exception { + public void testWriteCharArray() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.write(new char[] { 'A', 'B', 'C' }); @@ -235,7 +235,7 @@ public class ProxyWriterTest { } @Test - public void writeCharArrayPartial() throws Exception { + public void testWriteCharArrayPartial() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.write(new char[] { 'A', 'B', 'C' }, 1, 2); @@ -244,7 +244,7 @@ public class ProxyWriterTest { } @Test - public void writeInt() throws Exception { + public void testWriteInt() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.write(65); @@ -253,7 +253,7 @@ public class ProxyWriterTest { } @Test - public void writeString() throws Exception { + public void testWriteString() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.write("ABC"); @@ -262,7 +262,7 @@ public class ProxyWriterTest { } @Test - public void writeStringPartial() throws Exception { + public void testWriteStringPartial() throws Exception { try (StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer)) { proxy.write("ABC", 1, 2); diff --git a/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java b/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java index 8502e05b..4ac19419 100644 --- a/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java +++ b/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java @@ -66,7 +66,7 @@ public class QueueOutputStreamTest { } @Test - public void writeInterrupted() throws Exception { + public void testWriteInterrupted() throws Exception { try (QueueOutputStream outputStream = new QueueOutputStream(new LinkedBlockingQueue<>(1)); final QueueInputStream inputStream = outputStream.newQueueInputStream()) { @@ -97,7 +97,7 @@ public class QueueOutputStreamTest { } @Test - public void writeString() throws Exception { + public void testWriteString() throws Exception { try (QueueOutputStream outputStream = new QueueOutputStream(); final QueueInputStream inputStream = outputStream.newQueueInputStream()) { outputStream.write("ABC".getBytes(UTF_8)); @@ -107,7 +107,7 @@ public class QueueOutputStreamTest { } @Test - public void writeStringMultiThread() throws Exception { + public void testWriteStringMultiThread() throws Exception { try (QueueOutputStream outputStream = callInThrowAwayThread(QueueOutputStream::new); final QueueInputStream inputStream = callInThrowAwayThread(outputStream::newQueueInputStream)) { callInThrowAwayThread(() -> { diff --git a/src/test/java/org/apache/commons/io/serialization/FullClassNameMatcherTest.java b/src/test/java/org/apache/commons/io/serialization/FullClassNameMatcherTest.java index f92d6052..eaad14bd 100644 --- a/src/test/java/org/apache/commons/io/serialization/FullClassNameMatcherTest.java +++ b/src/test/java/org/apache/commons/io/serialization/FullClassNameMatcherTest.java @@ -31,13 +31,13 @@ public class FullClassNameMatcherTest { private static final String [] NAMES_ARRAY = { Integer.class.getName(), Long.class.getName() }; @Test - public void noNames() { + public void testNoNames() { final FullClassNameMatcher m = new FullClassNameMatcher(); assertFalse(m.matches(Integer.class.getName())); } @Test - public void withNames() { + public void testWithNames() { final FullClassNameMatcher m = new FullClassNameMatcher(NAMES_ARRAY); assertTrue(m.matches(Integer.class.getName())); assertFalse(m.matches(String.class.getName())); diff --git a/src/test/java/org/apache/commons/io/serialization/MoreComplexObjectTest.java b/src/test/java/org/apache/commons/io/serialization/MoreComplexObjectTest.java index 87900d3b..053f84dc 100644 --- a/src/test/java/org/apache/commons/io/serialization/MoreComplexObjectTest.java +++ b/src/test/java/org/apache/commons/io/serialization/MoreComplexObjectTest.java @@ -88,7 +88,7 @@ public class MoreComplexObjectTest extends AbstractCloseableListTest { * might be ok in controlled environments. */ @Test - public void useBlacklist() throws IOException, ClassNotFoundException { + public void testUseBlacklist() throws IOException, ClassNotFoundException { final String [] blacklist = { "org.apache.commons.collections.functors.InvokerTransformer", "org.codehaus.groovy.runtime.ConvertedClosure", diff --git a/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java b/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java index 00244248..420e0b43 100644 --- a/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java @@ -46,7 +46,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { private InputStream testStream; @Test - public void acceptCustomMatcher() throws Exception { + public void testAcceptCustomMatcher() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept(ALWAYS_TRUE) @@ -54,7 +54,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void acceptPattern() throws Exception { + public void testAcceptPattern() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept(Pattern.compile(".*MockSerializedClass.*")) @@ -62,7 +62,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void acceptWildcard() throws Exception { + public void testAcceptWildcard() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept("org.apache.commons.io.*") @@ -75,7 +75,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void customInvalidMethod() { + public void testCustomInvalidMethod() { class CustomVOIS extends ValidatingObjectInputStream { CustomVOIS(final InputStream is) throws IOException { super(is); @@ -95,7 +95,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void exceptionIncludesClassName() throws Exception { + public void testExceptionIncludesClassName() throws Exception { try { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream))); @@ -107,13 +107,13 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void noAccept() { + public void testNoAccept() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)))); } @Test - public void ourTestClassAcceptedFirst() throws Exception { + public void testOurTestClassAcceptedFirst() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept(MockSerializedClass.class, Integer.class) @@ -121,7 +121,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void ourTestClassAcceptedFirstWildcard() throws Exception { + public void testOurTestClassAcceptedFirstWildcard() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept("*MockSerializedClass", "*Integer") @@ -129,7 +129,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void ourTestClassAcceptedSecond() throws Exception { + public void testOurTestClassAcceptedSecond() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept(Integer.class, MockSerializedClass.class) @@ -137,7 +137,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void ourTestClassAcceptedSecondWildcard() throws Exception { + public void testOurTestClassAcceptedSecondWildcard() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept("*Integer", "*MockSerializedClass") @@ -145,7 +145,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void ourTestClassNotAccepted() { + public void testOurTestClassNotAccepted() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) @@ -154,7 +154,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void ourTestClassOnlyAccepted() throws Exception { + public void testOurTestClassOnlyAccepted() throws Exception { assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) .accept(MockSerializedClass.class) @@ -162,7 +162,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void reject() { + public void testReject() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) @@ -172,7 +172,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void rejectCustomMatcher() { + public void testRejectCustomMatcher() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) @@ -182,7 +182,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void rejectOnly() { + public void testRejectOnly() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) @@ -191,7 +191,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void rejectPattern() { + public void testRejectPattern() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) @@ -201,7 +201,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void rejectPrecedence() { + public void testRejectPrecedence() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) @@ -211,7 +211,7 @@ public class ValidatingObjectInputStreamTest extends AbstractCloseableListTest { } @Test - public void rejectWildcard() { + public void testRejectWildcard() { assertThrows(InvalidClassException.class, () -> assertSerialization( closeAfterEachTest(new ValidatingObjectInputStream(testStream)) diff --git a/src/test/java/org/apache/commons/io/serialization/WildcardClassNameMatcherTest.java b/src/test/java/org/apache/commons/io/serialization/WildcardClassNameMatcherTest.java index 6da59cce..c793247f 100644 --- a/src/test/java/org/apache/commons/io/serialization/WildcardClassNameMatcherTest.java +++ b/src/test/java/org/apache/commons/io/serialization/WildcardClassNameMatcherTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; public class WildcardClassNameMatcherTest { @Test - public void noPattern() { + public void testNoPattern() { final ClassNameMatcher ca = new WildcardClassNameMatcher("org.foo"); assertTrue(ca.matches("org.foo")); assertFalse(ca.matches("org.foo.and.more")); @@ -37,14 +37,14 @@ public class WildcardClassNameMatcherTest { } @Test - public void star() { + public void testStar() { final ClassNameMatcher ca = new WildcardClassNameMatcher("org*"); assertTrue(ca.matches("org.foo.should.match")); assertFalse(ca.matches("bar.should.not.match")); } @Test - public void starAndQuestionMark() { + public void testStarAndQuestionMark() { final ClassNameMatcher ca = new WildcardClassNameMatcher("org?apache?something*"); assertTrue(ca.matches("org.apache_something.more")); assertFalse(ca.matches("org..apache_something.more"));
