RFR: 8296387: [Tooltip, CSS] -fx-show-delay is only applied to the first tooltip that is shown before it is displayed [v9]
Andy Goryachev
angorya at openjdk.org
Mon Jul 8 17:55:40 UTC 2024
On Sat, 6 Jul 2024 11:18:07 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
>> tests/system/src/test/java/test/robot/javafx/scene/TooltipTest.java line 81:
>>
>>> 79:
>>> 80: @AfterAll
>>> 81: static void exit() {
>>
>> I still not convinced I like the concept of non-public methods in tests, since they are annotated.
>>
>> Why do we need to do this?
>
> Please check: https://stackoverflow.com/questions/55215949/why-junit-5-default-access-modifier-changed-to-package-private
>
> It is essentially the good old 'why make something public when you do not need it?'.
> It follows the way encapsulation is meant to be, by lowering the visibility as far as you can for something that is not meant to be called from the outside.
>
> Also static code analysis will check that and issue a code smell, which makes sense. Quoting Sonarlint here:
>
> "
> JUnit5 is more tolerant regarding the visibility of test classes and methods than JUnit4, which required everything to be public. Test classes and methods can have any visibility except private. It is however recommended to use the default package visibility to improve readability.
>
> Test classes, test methods, and lifecycle methods are not required to be public, but they must not be private.
> It is generally recommended to omit the public modifier for test classes, test methods, and lifecycle methods unless there is a technical reason for doing so – for example, when a test class is extended by a test class in another package. Another technical reason for making classes and methods public is to simplify testing on the module path when using the Java Module System.
> — JUnit5 User Guide
> "
thank you for clarification!
there seems to be no downside to making the test methods non public, and some upside.
we might suggest doing so for every new test we write, similarly to the requirement to use junit5 instead of junit4.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1394#discussion_r1669051087
More information about the openjfx-dev
mailing list