RFR: 8304014: Convert test/jdk/java/util/zip/ZipFile/CorruptedZipFiles.java to junit [v5]
Eirik Bjorsnos
duke at openjdk.org
Fri Mar 31 13:54:19 UTC 2023
On Fri, 31 Mar 2023 13:51:22 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:
>> CorruptedZipFiles could benefit from some spring cleaning and a conversion to testNG:
>>
>> - The actual tests are moved into their own `@Test` methods, given more meaningful names and a Javadoc comment explaining the constraint being verified
>> - The setup code is moved to a `@Before` method, slightly modernized and rewritten to take advantage of `assertEquals`
>> - `checkZipExceptionImpl` is updated to take advantage of `expectThrows`
>> - A bunch of constants copied over from `ZipFile` can be deleted since JDK-6225935 has long been fixed
>
> Eirik Bjorsnos has updated the pull request incrementally with four additional commits since the last revision:
>
> - Document the structure of the 'good' ZIP
> - Use the "Validate that.." comment style
> - Document the ByteBuffer with a comment
> - Use ByteBuffer when manipulating multi-byte fields
Following an offline discussion with Lance, I added the following improvements:
- Use a little-endian ByteBuffer to manipulate multi-byte fields (Manipulating single bytes seemed too 'magic')
- Document the structure of the 'good' ZIP by including the `zipdetails`. (Maintainers should not be expected to know every detail of the ZIP format)
- Use the 'Validate that a ZipException is thrown..' comment style consistently (Easier to read)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/12563#issuecomment-1491958480
More information about the core-libs-dev
mailing list