Skip to content

Commit 006b74c

Browse files
author
Vincent Potucek
committed
testIssue2532
1 parent 3527c38 commit 006b74c

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,14 @@ void testRemoveUnusedImports() throws Exception {
3030
mavenRunner().withArguments("spotless:apply").runNoError();
3131
assertFile(path).sameAsResource("java/removeunusedimports/JavaCodeWithPackageFormatted.test");
3232
}
33+
34+
@Test
35+
void testIssue2532() throws Exception {
36+
writePomWithJavaSteps("<removeUnusedImports/>");
37+
38+
String path = "src/main/java/test.java";
39+
setFile(path).toResource("java/removeunusedimports/Issue2532Pre.test");
40+
mavenRunner().withArguments("spotless:apply").runNoError();
41+
assertFile(path).sameAsResource("java/removeunusedimports/Issue2532Post.test");
42+
}
3343
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package hello.world;
2+
3+
import mylib.UsedB;
4+
import mylib.UsedA;
5+
6+
public class Java {
7+
public static void main(String[] args) {
8+
System.out.println("hello");
9+
UsedB.someMethod();
10+
UsedA.someMethod();
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package hello.world;
2+
3+
import mylib.UsedB;
4+
import mylib.UsedA;
5+
6+
public class Java {
7+
public static void main(String[] args) {
8+
System.out.println("hello");
9+
UsedB.someMethod();
10+
UsedA.someMethod();
11+
}
12+
}

0 commit comments

Comments
 (0)