openrewrite / rewrite-testing-frameworks

OpenRewrite recipes that perform common Java testing migration tasks.
Apache License 2.0
76 stars 68 forks source link

RemoveTestPrefix should also remove prefixes of implicitly referenced @MethodSource methods #462

Open koppor opened 8 months ago

koppor commented 8 months ago

When @MethodSource is hit, the referenced method should also be renamed

     @ParameterizedTest
     @MethodSource
-    void testContainsWhitespace(Boolean expected, String input) {
+    void containsWhitespace(Boolean expected, String input) {
        assertEquals(expected, StringUtil.containsWhitespace(input));
    }

That should also do

-    static Stream<Arguments> testContainsWhitespace() {
+    static Stream<Arguments> containsWhitespace() {

(but does not)

Relates to https://github.com/openrewrite/rewrite-testing-frameworks/issues/258

timtebeek commented 8 months ago

Pushed up a small change to at least do no harm for now https://github.com/openrewrite/rewrite-testing-frameworks/commit/a426e409ca3b8e04c6470e86cc09d61346e7c0f4 We can keep this issue open for an improvement that also renames the implied method source, or introduces an explicitly named method source annotation argument.