RFR: 8253876: jdk/test/lib/hexdump/ASN1FormatterTest.java fails with "AssertionError: Lines expected [126] but found [202]"

Roger Riggs rriggs at openjdk.java.net
Wed Oct 7 13:53:08 UTC 2020


On Wed, 7 Oct 2020 07:25:40 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> The HexPrinter test utility should be ignoring \r characters from the formatter.
>> It looks for \n and generates System.lineSeparator() at the end of each line.
>> 
>> With this fix, the ASN1FormatterTest can be removed from the ProblemList.
>
> I am puzzled about this change. I feels weird to drop proper line separator from `ASN1Formatter` to please the test.
> And it does not even look complete, because `ASN1Formatter` still uses `String.format("...%n", ...)` sometimes, that
> still uses system line separator.  Can the test be made resilient by watching out for `lineSeparator()`, instead of
> just `\n`?

The real fix for the test failing was the change in HexPrinter to ignore the <CR> when it is breaking lines from the
formatter. HexPrinter expected only /n from the formatter.

However, since the formatters can be used independently of HexPrinter, they should use System.lineSeparator() to work
consistently.  I'll put back the System.lineSepartor() use and re-test.

-------------

PR: https://git.openjdk.java.net/jdk/pull/486


More information about the core-libs-dev mailing list