The test PrinterTest#testPrettyPrinting compares the result of Printers.printString to a hard-coded string based on a specific order of entries in HashMap and HashSet. However, these classes do not guarantee that order, and the assertion can fail if the order differs.
The PR uses LinkedHashMap and LinkedHashSet to make the order and the string deterministic.
The test
PrinterTest#testPrettyPrinting
compares the result ofPrinters.printString
to a hard-coded string based on a specific order of entries inHashMap
andHashSet
. However, these classes do not guarantee that order, and the assertion can fail if the order differs.The PR uses
LinkedHashMap
andLinkedHashSet
to make the order and the string deterministic.