Underscores may appear in JUnit test method names to separate logical components of the name, with each component written in lowerCamelCase, for example transferMoney_deductsFromSource. There is no One Correct Way to name test methods.
Could you clarify whether this exception applies strictly to the methods annotated with a JUnit test annotation such as @Test, @RepeatedTest, or @ParameteriezedTest? Could it not also apply a conventionally-named method corresponding to a test annotated @ParameterizedTest @MethodSource, with no value specified for @MethodSource? In such a case, JUnit looks for a static method with the same name to provide the parameters. The IDE may even report an error if the method does not exist and offer to create a stub. Take this source for example.
Section 5.2.3 of the Java Style Guide states
Could you clarify whether this exception applies strictly to the methods annotated with a JUnit test annotation such as
@Test
,@RepeatedTest
, or@ParameteriezedTest
? Could it not also apply a conventionally-named method corresponding to a test annotated@ParameterizedTest @MethodSource
, with no value specified for@MethodSource
? In such a case, JUnit looks for a static method with the same name to provide the parameters. The IDE may even report an error if the method does not exist and offer to create a stub. Take this source for example.See also checkstyle/checkstyle#15429, checkstyle/checkstyle#15556, checkstyle/checkstyle#15599.