Skip to content

Commit cf8561a

Browse files
committed
changes
1 parent b3c1664 commit cf8561a

File tree

3 files changed

+7
-24
lines changed

3 files changed

+7
-24
lines changed

src/test/java/org/checkstyle/autofix/recipe/AbstractRecipeTest.java

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.io.File;
88
import java.nio.file.Files;
99
import java.nio.file.Path;
10-
import java.util.ArrayList;
1110
import java.util.Collections;
1211
import java.util.List;
1312

@@ -40,7 +39,7 @@ public abstract class AbstractRecipeTest extends AbstractXmlTestSupport implemen
4039
* Creates the recipe with violations and configs.
4140
*/
4241
protected abstract Recipe createRecipe(List<CheckstyleViolation> violations,
43-
List<CheckConfiguration> checkConfigs);
42+
CheckConfiguration checkConfigs);
4443

4544
@Override
4645
protected String getPackageLocation() {
@@ -58,7 +57,7 @@ protected void verify(String testCaseName) throws Exception {
5857

5958
final List<CheckstyleViolation> violations = runCheckstyleAndGetViolations(inputPath);
6059

61-
final List<CheckConfiguration> checkConfigs = getAllCheckConfigurations(inputPath);
60+
final CheckConfiguration checkConfigs = getAllCheckConfigurations(inputPath);
6261

6362
final String beforeCode = readFile(getPath(inputPath));
6463
final String expectedAfterCode = readFile(getPath(outputPath));
@@ -94,28 +93,11 @@ private List<CheckstyleViolation> runCheckstyleAndGetViolations(String inputPath
9493
}
9594
}
9695

97-
private List<CheckConfiguration> getAllCheckConfigurations(String inputPath) throws Exception {
96+
private CheckConfiguration getAllCheckConfigurations(String inputPath) throws Exception {
9897
final String configFilePath = getPath(inputPath);
9998
final TestInputConfiguration testInputConfiguration =
10099
InlineConfigParser.parse(configFilePath);
101-
final Configuration parsedConfig = testInputConfiguration.createConfiguration();
102-
103-
final List<CheckConfiguration> checkConfigs = new ArrayList<>();
104-
105-
for (Configuration child : parsedConfig.getChildren()) {
106-
if ("TreeWalker".equals(child.getName())) {
107-
for (Configuration check : child.getChildren()) {
108-
final CheckConfiguration checkConfig = ConfigurationLoader.mapConfiguration(check);
109-
checkConfigs.add(checkConfig);
110-
}
111-
}
112-
}
113-
114-
if (checkConfigs.isEmpty()) {
115-
throw new IllegalStateException("No check configurations found");
116-
}
117-
118-
return checkConfigs;
100+
return ConfigurationLoader.mapConfiguration(testInputConfiguration.createConfiguration());
119101
}
120102

121103
/**

src/test/java/org/checkstyle/autofix/recipe/UpperEllTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected String getSubpackage() {
3636

3737
@Override
3838
protected Recipe createRecipe(List<CheckstyleViolation> violations,
39-
List<CheckConfiguration> checkConfigs) {
39+
CheckConfiguration checkConfigs) {
4040

4141
return new UpperEll(violations);
4242
}

src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/InputHexOctalLiteral.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
2-
UpperEll
2+
com.puppycrawl.tools.checkstyle.checks.UpperEllCheck
3+
34
*/
45

56

0 commit comments

Comments
 (0)