JetBrains / JetBrainsRuntime

Runtime environment based on OpenJDK for running IntelliJ Platform-based products on Windows, macOS, and Linux
GNU General Public License v2.0
1.26k stars 192 forks source link

JBR-6984 Fix BoxLayout/NPECheckRequests test #358

Closed stachenov closed 4 months ago

stachenov commented 4 months ago

It was initially written and tested on Linux, but it turns out that on other systems validate() can be called in between init() and start() calls, which would break the test even though BoxLayout isn't broken.

Fix by overriding validate() and ignoring exceptions that were intentionally thrown by us. This both fixes the test and ensures that BoxLayout remains broken until we're ready to test it.

stachenov commented 4 months ago

Shouldn't it be checked that RuntimeException originated from BrokeComponent.getPreferredSize? Whether other causes cannot lead to RuntimeException during the above actions... Even RuntimeException originated from BrokeComponent.getPreferredSize I would log it like RuntimeException was thrown by BrokeComponent.getPreferredSize - expected

Fixed by using a custom exception class instead. Added logging as well.

BTW in order to avoid including unrelated commits into PR you should rebase PR-branch on top of the latest state of the branch main and make force-push.

That's what I did, but apparently the main branch got updated right afterwards. Force-pushed again with the new fix (or should I squash those instead?).

mkartashev commented 4 months ago

Merged into main, jbr21, jbr17.