Skip to content

Commit 9d3735a

Browse files
author
Vincent Potucek
committed
use default field for default test path
1 parent b7c829e commit 9d3735a

31 files changed

+55
-67
lines changed

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinExtensionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -231,7 +231,7 @@ void testWithCustomMaxWidthDefaultStyleKtfmt() throws IOException {
231231
}
232232

233233
private void checkKtlintOfficialStyle() throws IOException {
234-
String path = "src/main/kotlin/Main.kt";
234+
path = "src/main/kotlin/Main.kt";
235235
setFile(path).toResource("kotlin/ktlint/experimentalEditorConfigOverride.dirty");
236236
gradleRunner().withArguments("spotlessApply").build();
237237
assertFile(path).sameAsResource("kotlin/ktlint/experimentalEditorConfigOverride.ktlintOfficial.clean");

plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenProvisionerTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,6 @@ void testSingleDependencyIncludingTransitives() throws Exception {
3838
}
3939

4040
private void assertResolveDependenciesWorks() throws Exception {
41-
String path = "src/main/java/test.java";
4241
String unformattedContent = "package a;";
4342
setFile(path).toContent(unformattedContent);
4443
mavenRunner().withArguments("spotless:apply").runNoError();

plugin-maven/src/test/java/com/diffplug/spotless/maven/antlr4/Antlr4FormatterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ void applyUsingDefaultVersionSelfclosing() throws Exception {
4646
}
4747

4848
private void runTest() throws Exception {
49-
String path = "src/main/antlr4/Hello.g4";
49+
path = "src/main/antlr4/Hello.g4";
5050
setFile(path).toResource("antlr4/Hello.unformatted.g4");
5151
mavenRunner().withArguments("spotless:apply").runNoError();
5252
assertFile(path).sameAsResource("antlr4/Hello.formatted.g4");

plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/IndentTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,7 +48,6 @@ private void runToSpacesTest() throws Exception {
4848
}
4949

5050
private void runTest(String source, String target) throws Exception {
51-
String path = "src/main/java/test.java";
5251
setFile(path).toResource(source);
5352
mavenRunner().withArguments("spotless:apply").runNoError();
5453
assertFile(path).sameAsResource(target);

plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/Jsr223Test.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 DiffPlug
2+
* Copyright 2021-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,6 @@ public void groovyFromJarState() throws Exception {
5151
}
5252

5353
private void runTest(String sourceContent, String targetContent) throws Exception {
54-
String path = "src/main/java/test.java";
5554
setFile(path).toContent(sourceContent);
5655
mavenRunner().withArguments("spotless:apply").runNoError();
5756
assertFile(path).hasContent(targetContent);

plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/LicenseHeaderTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ void fromContentGroovy() throws Exception {
6161
" </content>",
6262
"</licenseHeader>");
6363

64-
String path = "src/main/groovy/test.groovy";
64+
path = "src/main/groovy/test.groovy";
6565
setFile(path).toResource("license/MissingLicense.test");
6666
mavenRunner().withArguments("spotless:apply").runNoError();
6767
assertFile(path).sameAsResource("license/HasLicense.test");
@@ -123,7 +123,7 @@ void fromContentKotlin() throws Exception {
123123
" </content>",
124124
"</licenseHeader>");
125125

126-
String path = "src/main/kotlin/test.kt";
126+
path = "src/main/kotlin/test.kt";
127127
String noLicenseHeader = getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
128128

129129
setFile(path).toContent(noLicenseHeader);
@@ -142,7 +142,6 @@ void unsupportedModuleInfo() throws Exception {
142142
}
143143

144144
private void runTest() throws Exception {
145-
String path = "src/main/java/test.java";
146145
setFile(path).toResource("license/MissingLicense.test");
147146
mavenRunner().withArguments("spotless:apply").runNoError();
148147
assertFile(path).sameAsResource("license/HasLicense.test");
@@ -156,7 +155,7 @@ private void testUnsupportedFile(String file) throws Exception {
156155
" </content>",
157156
"</licenseHeader>");
158157

159-
String path = "src/main/java/com/diffplug/spotless/" + file;
158+
path = "src/main/java/com/diffplug/spotless/" + file;
160159
setFile(path).toResource("license/" + file + ".test");
161160

162161
mavenRunner().withArguments("spotless:apply").runNoError();

plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/LineEndingsTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,7 +44,6 @@ private void runToUnixTest() throws Exception {
4444
}
4545

4646
private void runTest(String sourceContent, String targetContent) throws Exception {
47-
String path = "src/main/java/test.java";
4847
setFile(path).toContent(sourceContent);
4948
mavenRunner().withArguments("spotless:apply").runNoError();
5049
assertFile(path).hasContent(targetContent);

plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/NativeCmdTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 DiffPlug
2+
* Copyright 2021-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,7 +41,6 @@ public void fromStdInToStdOut() throws Exception {
4141
}
4242

4343
private void runTest(String sourceContent, String targetContent) throws Exception {
44-
String path = "src/main/java/test.java";
4544
setFile(path).toContent(sourceContent);
4645
mavenRunner().withArguments("spotless:apply").runNoError();
4746
assertFile(path).hasContent(targetContent);

plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/ReplaceRegexTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ void fromContent() throws Exception {
3434
}
3535

3636
private void runTest(String sourceContent, String targetContent) throws Exception {
37-
String path = "src/main/java/test.java";
3837
setFile(path).toContent(sourceContent);
3938
mavenRunner().withArguments("spotless:apply").runNoError();
4039
assertFile(path).hasContent(targetContent);

plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/ReplaceTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@ void fromContent() throws Exception {
3333
}
3434

3535
private void runTest(String sourceContent, String targetContent) throws Exception {
36-
String path = "src/main/java/test.java";
3736
setFile(path).toContent(sourceContent);
3837
mavenRunner().withArguments("spotless:apply").runNoError();
3938
assertFile(path).hasContent(targetContent);

0 commit comments

Comments
 (0)