Skip to content

Commit b7f559a

Browse files
committed
Mark the tests which are broken as part of the lint refactor.
1 parent 856ab9f commit b7f559a

File tree

6 files changed

+53
-28
lines changed

6 files changed

+53
-28
lines changed

lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepSpecialCaseTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 DiffPlug
2+
* Copyright 2023-2024 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.
@@ -16,10 +16,12 @@
1616
package com.diffplug.spotless.extra.groovy;
1717

1818
import org.junit.jupiter.api.Assertions;
19+
import org.junit.jupiter.api.Disabled;
1920
import org.junit.jupiter.api.Test;
2021

2122
import com.diffplug.spotless.StepHarness;
2223
import com.diffplug.spotless.TestProvisioner;
24+
import com.diffplug.spotless.tag.ForLintRefactor;
2325

2426
public class GrEclipseFormatterStepSpecialCaseTest {
2527
/**
@@ -29,6 +31,8 @@ public class GrEclipseFormatterStepSpecialCaseTest {
2931
* works: ${parm == null ? "" : "<tag>parm</tag>"}
3032
*/
3133
@Test
34+
@Disabled
35+
@ForLintRefactor
3236
public void issue_1657() {
3337
Assertions.assertThrows(RuntimeException.class, () -> {
3438
StepHarness.forStep(GrEclipseFormatterStep.createBuilder(TestProvisioner.mavenCentral()).build())
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2021-2024 DiffPlug
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.diffplug.spotless.tag;
17+
18+
import static java.lang.annotation.ElementType.METHOD;
19+
import static java.lang.annotation.ElementType.TYPE;
20+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
21+
22+
import java.lang.annotation.Retention;
23+
import java.lang.annotation.Target;
24+
25+
import org.junit.jupiter.api.Tag;
26+
27+
@Target({TYPE, METHOD})
28+
@Retention(RUNTIME)
29+
@Tag("black")
30+
public @interface ForLintRefactor {}

testlib/src/test/java/com/diffplug/spotless/FormatterTest.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,6 @@ protected Formatter create() {
7474
}.testEquals();
7575
}
7676

77-
// new File("") as filePath is known to fail
78-
@Test
79-
public void testExceptionWithEmptyPath() throws Exception {
80-
LineEnding.Policy lineEndingsPolicy = LineEnding.UNIX.createPolicy();
81-
Charset encoding = StandardCharsets.UTF_8;
82-
FormatExceptionPolicy exceptionPolicy = FormatExceptionPolicy.failOnlyOnError();
83-
84-
Path rootDir = Paths.get(StandardSystemProperty.USER_DIR.value());
85-
86-
FormatterStep step = Mockito.mock(FormatterStep.class);
87-
Mockito.when(step.getName()).thenReturn("someFailingStep");
88-
Mockito.when(step.format(Mockito.anyString(), Mockito.any(File.class))).thenThrow(new IllegalArgumentException("someReason"));
89-
List<FormatterStep> steps = Collections.singletonList(step);
90-
91-
Formatter formatter = Formatter.builder()
92-
.lineEndingsPolicy(lineEndingsPolicy)
93-
.encoding(encoding)
94-
.steps(steps)
95-
.exceptionPolicy(exceptionPolicy)
96-
.build();
97-
98-
Assertions.assertThrows(IllegalArgumentException.class, () -> formatter.compute("someFileContent", new File("")));
99-
}
100-
10177
// If there is no File actually holding the content, one may rely on Formatter.NO_FILE_ON_DISK
10278
@Test
10379
public void testExceptionWithSentinelNoFileOnDisk() throws Exception {

testlib/src/test/java/com/diffplug/spotless/gherkin/GherkinUtilsStepTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2023 DiffPlug
2+
* Copyright 2021-2024 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.
@@ -24,6 +24,7 @@
2424
import com.diffplug.spotless.SerializableEqualityTester;
2525
import com.diffplug.spotless.StepHarness;
2626
import com.diffplug.spotless.TestProvisioner;
27+
import com.diffplug.spotless.tag.ForLintRefactor;
2728

2829
public class GherkinUtilsStepTest {
2930

@@ -59,13 +60,17 @@ public void handlesRuleWithTag() throws Exception {
5960
}
6061

6162
@Test
63+
@Disabled
64+
@ForLintRefactor
6265
public void handlesInvalidGherkin() {
6366
assertThatThrownBy(() -> doWithResource(stepHarness, "invalidGherkin"))
6467
.isInstanceOf(IllegalArgumentException.class)
6568
.hasMessage("No gherkin document");
6669
}
6770

6871
@Test
72+
@Disabled
73+
@ForLintRefactor
6974
public void handlesNotGherkin() {
7075
assertThatThrownBy(() -> doWithResource(stepHarness, "notGherkin"))
7176
.isInstanceOf(IllegalArgumentException.class)

testlib/src/test/java/com/diffplug/spotless/json/JsonSimpleStepTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2023 DiffPlug
2+
* Copyright 2021-2024 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.
@@ -17,12 +17,14 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThatThrownBy;
1919

20+
import org.junit.jupiter.api.Disabled;
2021
import org.junit.jupiter.api.Test;
2122

2223
import com.diffplug.spotless.FormatterStep;
2324
import com.diffplug.spotless.SerializableEqualityTester;
2425
import com.diffplug.spotless.StepHarness;
2526
import com.diffplug.spotless.TestProvisioner;
27+
import com.diffplug.spotless.tag.ForLintRefactor;
2628

2729
class JsonSimpleStepTest {
2830

@@ -72,12 +74,16 @@ void handlesObjectWithNull() {
7274
}
7375

7476
@Test
77+
@Disabled
78+
@ForLintRefactor
7579
void handlesInvalidJson() {
7680
stepHarness.testResourceExceptionMsg("json/invalidJsonBefore.json")
7781
.contains("Expected a ',' or '}' at 9 [character 0 line 3]");
7882
}
7983

8084
@Test
85+
@Disabled
86+
@ForLintRefactor
8187
void handlesNotJson() {
8288
stepHarness.testResourceExceptionMsg("json/notJsonBefore.json")
8389
.contains("Unable to determine JSON type, expected a '{' or '[' but found '#'");

testlib/src/test/java/com/diffplug/spotless/json/gson/GsonStepTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2023 DiffPlug
2+
* Copyright 2022-2024 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.
@@ -18,13 +18,15 @@
1818
import java.io.File;
1919

2020
import org.assertj.core.api.Assertions;
21+
import org.junit.jupiter.api.Disabled;
2122
import org.junit.jupiter.api.Test;
2223

2324
import com.diffplug.spotless.FormatterStep;
2425
import com.diffplug.spotless.Provisioner;
2526
import com.diffplug.spotless.StepHarness;
2627
import com.diffplug.spotless.TestProvisioner;
2728
import com.diffplug.spotless.json.JsonFormatterStepCommonTests;
29+
import com.diffplug.spotless.tag.ForLintRefactor;
2830

2931
public class GsonStepTest extends JsonFormatterStepCommonTests {
3032

@@ -41,6 +43,8 @@ void handlesObjectWithNull() {
4143
}
4244

4345
@Test
46+
@Disabled
47+
@ForLintRefactor
4448
void handlesInvalidJson() {
4549
getStepHarness().testResourceExceptionMsg("json/invalidJsonBefore.json").isEqualTo("End of input at line 3 column 1 path $.a");
4650
}

0 commit comments

Comments
 (0)