Sonar thinks methods are unused when they are actually used by ParameterizedTest

v2025.1 (102418)

@ParameterizedTest
@MethodSource({"methodOne", "methodTwo"})
<T> void test(T expected, T actual) {
}

private static Stream<Arguments> methodOne() { }

private static Stream<Arguments> methodTwo() { }

Sonar reports both of these static methods as not used. This is because it gets confused by multiple method references being passed to the annotation. If I only pass one method reference, then it understands and marks the passed method as used.

Hi @lbenedetto,

Thank you for the report, indeed we don’t handle correctly the case where the method names are passed in an array. Here is a ticket to fix the issue.

Cheers,
Erwan