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-compress.git
The following commit(s) were added to refs/heads/master by this push: new b8cbb0fd Inline single use local variable b8cbb0fd is described below commit b8cbb0fdf6fa6748cff65237163e4506f77452de Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Nov 4 07:05:13 2023 -0400 Inline single use local variable Format --- .../compressors/bzip2/PythonTruncatedBzip2Test.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java index 50af09e6..c7bae68f 100644 --- a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java +++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java @@ -38,6 +38,7 @@ import org.junit.jupiter.api.Test; /** * Testcase porting a test from Python's testsuite. + * * @see "https://issues.apache.org/jira/browse/COMPRESS-253" */ public class PythonTruncatedBzip2Test { @@ -76,27 +77,24 @@ public class PythonTruncatedBzip2Test { @BeforeEach public void initializeChannel() throws IOException { - final InputStream source = new ByteArrayInputStream(TRUNCATED_DATA); - this.bz2Channel = makeBZ2C(source); + this.bz2Channel = makeBZ2C(new ByteArrayInputStream(TRUNCATED_DATA)); } @Test public void testPartialReadTruncatedData() throws IOException { - //with BZ2File(self.filename) as f: - // self.assertEqual(f.read(len(self.TEXT)), self.TEXT) - // self.assertRaises(EOFError, f.read, 1) + // with BZ2File(self.filename) as f: + // self.assertEqual(f.read(len(self.TEXT)), self.TEXT) + // self.assertRaises(EOFError, f.read, 1) final int length = TEXT.length(); final ByteBuffer buffer1 = ByteBuffer.allocate(length); bz2Channel.read(buffer1); - assertArrayEquals(Arrays.copyOfRange(TEXT.getBytes(), 0, length), - buffer1.array()); + assertArrayEquals(Arrays.copyOfRange(TEXT.getBytes(), 0, length), buffer1.array()); // subsequent read should throw final ByteBuffer buffer2 = ByteBuffer.allocate(1); - assertThrows(IOException.class, () -> bz2Channel.read(buffer2), - "The read should have thrown."); + assertThrows(IOException.class, () -> bz2Channel.read(buffer2), "The read should have thrown."); } @Test