|
28 | 28 | import org.openrewrite.Recipe; |
29 | 29 | import org.openrewrite.test.RewriteTest; |
30 | 30 |
|
31 | | -/** |
32 | | - * Base test class for recipe testing that provides common functionality |
33 | | - * for reading test files and executing recipe tests with preprocessing. |
34 | | - */ |
35 | 31 | public abstract class AbstractRecipeTest implements RewriteTest { |
36 | 32 |
|
37 | 33 | private static final String BASE_TEST_RESOURCES_PATH = "src/test/resources/org" |
38 | 34 | + "/checkstyle/autofix/recipe/"; |
39 | 35 |
|
40 | | - /** |
41 | | - * Creates a preprocessing recipe that normalizes class names from InputXxx to OutputXxx. |
42 | | - * This allows test files to have descriptive names while maintaining consistent class names. |
43 | | - * |
44 | | - * @return the preprocessing recipe |
45 | | - */ |
46 | 36 | private Recipe createPreprocessingRecipe() { |
47 | 37 | return new InputClassRenamer(); |
48 | 38 | } |
49 | 39 |
|
50 | | - /** |
51 | | - * Creates the main recipe that should be tested. |
52 | | - * Subclasses must implement this method to provide their specific recipe. |
53 | | - * |
54 | | - * @return the main recipe to test |
55 | | - */ |
56 | 40 | protected abstract Recipe getRecipe(); |
57 | 41 |
|
58 | | - /** |
59 | | - * Tests a recipe with the given recipe path and test case name. |
60 | | - * Expects input and output files to follow the naming convention: |
61 | | - * - Input: {recipePath}/{testCaseName}/Input{testCaseName}.java |
62 | | - * - Output: {recipePath}/{testCaseName}/Output{testCaseName}.java |
63 | | - * The method automatically applies preprocessing to normalize class names |
64 | | - * before running the main recipe. |
65 | | - * |
66 | | - * @param recipePath the recipe-specific path. |
67 | | - * @param testCaseName the name of the test case (should match directory and file names) |
68 | | - * @throws IOException if files cannot be read |
69 | | - */ |
70 | | - protected void testRecipe(String recipePath, String testCaseName) |
71 | | - throws IOException { |
| 42 | + protected void testRecipe(String recipePath, String testCaseName) throws IOException { |
72 | 43 | final String testCaseDir = testCaseName.toLowerCase(); |
73 | 44 | final String inputFileName = "Input" + testCaseName + ".java"; |
74 | 45 | final String outputFileName = "Output" + testCaseName + ".java"; |
|
0 commit comments