File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
lib/src/main/java/com/diffplug/spotless/generic
plugin-maven/src/test/java/com/diffplug/spotless/maven/java Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1515 */
1616package com .diffplug .spotless .generic ;
1717
18+ import static com .diffplug .spotless .Lint .atLine ;
1819import static com .diffplug .spotless .Lint .atUndefinedLine ;
1920
2021import java .io .Serializable ;
@@ -64,7 +65,7 @@ FormatterFunc toFormatter() {
6465 FormatterFunc toLinter () {
6566 return raw -> {
6667 if (regex .matcher (raw ).find ()) {
67- throw atUndefinedLine ( "" , replacement ).shortcut ();
68+ throw atLine ( 11111 , "" , replacement ).shortcut ();
6869 }
6970 return raw ;
7071 };
Original file line number Diff line number Diff line change 1717
1818import static org .assertj .core .api .Assertions .assertThat ;
1919
20+ import com .diffplug .spotless .FormatterStep ;
21+
22+ import com .diffplug .spotless .StepHarnessWithFile ;
23+ import com .diffplug .spotless .TestProvisioner ;
24+ import com .diffplug .spotless .kotlin .KtLintStep ;
25+
26+ import org .assertj .core .api .AbstractStringAssert ;
2027import org .junit .jupiter .api .BeforeEach ;
2128import org .junit .jupiter .api .Test ;
2229
@@ -35,7 +42,16 @@ void init() throws Exception {
3542 void testRemoveWildcardImports () throws Exception {
3643 setFile (PATH ).toResource ("java/removewildcardimports/JavaCodeWildcardsUnformatted.test" );
3744 assertFile (PATH ).sameAsResource ("java/removewildcardimports/JavaCodeWildcardsFormatted.test" );
38- assertThat (mavenRunner ().withArguments ("spotless:apply" ).runHasError ().stdOutUtf8 ()).contains (ERROR );
45+ AbstractStringAssert <?> abstractStringAssert = assertThat (mavenRunner ().withArguments ("spotless:apply" ).runHasError ().stdOutUtf8 ());
46+ abstractStringAssert
47+ .contains (ERROR )
48+ // .contains("11111")
49+ ;
50+
51+ FormatterStep step = KtLintStep .create ("0.49.0" , TestProvisioner .mavenCentral ());
52+ StepHarnessWithFile .forStep (this , step )
53+ .testResource ("java/removewildcardimports/JavaCodeWildcardsUnformatted.test" , "java/removewildcardimports/JavaCodeWildcardsFormatted.test" )
54+ .expectLintsOfResource ("kotlin/ktlint/unsolvable.dirty" ).toBe ("L1 ktlint(standard:no-wildcard-imports) Wildcard import" );
3955 }
4056
4157 @ Test
You can’t perform that action at this time.
0 commit comments