|
17 | 17 |
|
18 | 18 | import org.junit.jupiter.api.Test; |
19 | 19 |
|
| 20 | +import com.diffplug.spotless.cli.CLIIntegrationHarness; |
20 | 21 | import com.diffplug.spotless.cli.SpotlessCLIRunner; |
21 | 22 | import com.diffplug.spotless.tag.CliProcessTest; |
22 | 23 |
|
23 | 24 | import static org.assertj.core.api.Assertions.assertThat; |
24 | 25 |
|
25 | 26 | @CliProcessTest |
26 | | -public class EclipseWtpTest extends EclipseWtpTestBase { |
| 27 | +public class EclipseWtpTest extends CLIIntegrationHarness { |
27 | 28 |
|
28 | 29 | // XML |
29 | 30 | @Test |
@@ -168,4 +169,42 @@ void itRespectsCustomVersion() { |
168 | 169 | assertThat(result.exitCode()).isNotEqualTo(0); |
169 | 170 | assertThat(result.stdErr()).contains("No such version " + invalidCustomVersion); |
170 | 171 | } |
| 172 | + |
| 173 | + protected String runEclipseWtpWithType(EclipseWtp.Type type, String unformatted) { |
| 174 | + String fileName = "test." + type.name().toLowerCase(); |
| 175 | + setFile(fileName).toContent(unformatted); |
| 176 | + |
| 177 | + SpotlessCLIRunner.Result result = cliRunner() |
| 178 | + .withTargets(fileName) |
| 179 | + .withStep(EclipseWtp.class) |
| 180 | + .withOption("--type", type.name()) |
| 181 | + .run(); |
| 182 | + |
| 183 | + return fileName; |
| 184 | + } |
| 185 | + |
| 186 | + protected String runEclipseWtpWithTypeInferred(String fileExtension, String unformatted) { |
| 187 | + String fileName = "test." + fileExtension; |
| 188 | + setFile(fileName).toContent(unformatted); |
| 189 | + |
| 190 | + SpotlessCLIRunner.Result result = |
| 191 | + cliRunner().withTargets(fileName).withStep(EclipseWtp.class).run(); |
| 192 | + |
| 193 | + return fileName; |
| 194 | + } |
| 195 | + |
| 196 | + protected String runEclipseWtpWithTypeAndConfigFile(EclipseWtp.Type type, String unformatted, String configFile) { |
| 197 | + String fileName = "test." + type.name().toLowerCase(); |
| 198 | + setFile(fileName).toContent(unformatted); |
| 199 | + setFile(configFile).toResource("eclipse-wtp/" + configFile); |
| 200 | + |
| 201 | + SpotlessCLIRunner.Result result = cliRunner() |
| 202 | + .withTargets(fileName) |
| 203 | + .withStep(EclipseWtp.class) |
| 204 | + .withOption("--type", type.name()) |
| 205 | + .withOption("--config-file", configFile) |
| 206 | + .run(); |
| 207 | + |
| 208 | + return fileName; |
| 209 | + } |
171 | 210 | } |
0 commit comments