RFR: 8295814: jdk/jshell/CommandCompletionTest.java fails with "lists don't have the same size expected [2] but found [1]"

Jan Lahoda jlahoda at openjdk.org
Wed Oct 26 17:02:26 UTC 2022


On Wed, 26 Oct 2022 10:28:19 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> File completion in CommandCompletionTest::testSet intermittently fails.
> Also message provided by org.testng.Assert::assertEquals is also not very verbose when comparing collections:
> "lists don't have the same size expected [2] but found [1]".
> 
> Cause of the failure is in the expected side of the assertion (CommandCompletionTest::getRootDirectories), which may conatain duplicates. While the actual side of the assertion is distinct (CommandCompletionTest::computeCompletions).
> 
> Proposed patch de-duplicates CommandCompletionTest::getRootDirectories and adds full description of the expected result to the error message for future debugging.
> 
> Please review.
> 
> Thanks,
> Adam

+1 on the improvement for the logging (although it is unfortunate the TestNG assert is not logging the difference properly by itself, as old asserts did).

But, I wonder if there are particular data showing the problem is in duplicate entries in `getRootDirectories()`. Offhand, that would seem like a less likely explanation. The expected value is a combination of files and directories in the current working directory, and the root directories. To me, it would seem like a more likely explanation that there is a file or directory that initially exists in the current working directory, but then disappears before the completion is computed.

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

PR: https://git.openjdk.org/jdk/pull/10870


More information about the kulla-dev mailing list