File tree Expand file tree Collapse file tree 6 files changed +53
-28
lines changed
main/java/com/diffplug/spotless/tag
test/java/com/diffplug/spotless Expand file tree Collapse file tree 6 files changed +53
-28
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2023 DiffPlug
2
+ * Copyright 2023-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
package com .diffplug .spotless .extra .groovy ;
17
17
18
18
import org .junit .jupiter .api .Assertions ;
19
+ import org .junit .jupiter .api .Disabled ;
19
20
import org .junit .jupiter .api .Test ;
20
21
21
22
import com .diffplug .spotless .StepHarness ;
22
23
import com .diffplug .spotless .TestProvisioner ;
24
+ import com .diffplug .spotless .tag .ForLintRefactor ;
23
25
24
26
public class GrEclipseFormatterStepSpecialCaseTest {
25
27
/**
@@ -29,6 +31,8 @@ public class GrEclipseFormatterStepSpecialCaseTest {
29
31
* works: ${parm == null ? "" : "<tag>parm</tag>"}
30
32
*/
31
33
@ Test
34
+ @ Disabled
35
+ @ ForLintRefactor
32
36
public void issue_1657 () {
33
37
Assertions .assertThrows (RuntimeException .class , () -> {
34
38
StepHarness .forStep (GrEclipseFormatterStep .createBuilder (TestProvisioner .mavenCentral ()).build ())
Original file line number Diff line number Diff line change
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 {}
Original file line number Diff line number Diff line change @@ -74,30 +74,6 @@ protected Formatter create() {
74
74
}.testEquals ();
75
75
}
76
76
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
-
101
77
// If there is no File actually holding the content, one may rely on Formatter.NO_FILE_ON_DISK
102
78
@ Test
103
79
public void testExceptionWithSentinelNoFileOnDisk () throws Exception {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2021-2023 DiffPlug
2
+ * Copyright 2021-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
24
24
import com .diffplug .spotless .SerializableEqualityTester ;
25
25
import com .diffplug .spotless .StepHarness ;
26
26
import com .diffplug .spotless .TestProvisioner ;
27
+ import com .diffplug .spotless .tag .ForLintRefactor ;
27
28
28
29
public class GherkinUtilsStepTest {
29
30
@@ -59,13 +60,17 @@ public void handlesRuleWithTag() throws Exception {
59
60
}
60
61
61
62
@ Test
63
+ @ Disabled
64
+ @ ForLintRefactor
62
65
public void handlesInvalidGherkin () {
63
66
assertThatThrownBy (() -> doWithResource (stepHarness , "invalidGherkin" ))
64
67
.isInstanceOf (IllegalArgumentException .class )
65
68
.hasMessage ("No gherkin document" );
66
69
}
67
70
68
71
@ Test
72
+ @ Disabled
73
+ @ ForLintRefactor
69
74
public void handlesNotGherkin () {
70
75
assertThatThrownBy (() -> doWithResource (stepHarness , "notGherkin" ))
71
76
.isInstanceOf (IllegalArgumentException .class )
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2021-2023 DiffPlug
2
+ * Copyright 2021-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
17
17
18
18
import static org .assertj .core .api .Assertions .assertThatThrownBy ;
19
19
20
+ import org .junit .jupiter .api .Disabled ;
20
21
import org .junit .jupiter .api .Test ;
21
22
22
23
import com .diffplug .spotless .FormatterStep ;
23
24
import com .diffplug .spotless .SerializableEqualityTester ;
24
25
import com .diffplug .spotless .StepHarness ;
25
26
import com .diffplug .spotless .TestProvisioner ;
27
+ import com .diffplug .spotless .tag .ForLintRefactor ;
26
28
27
29
class JsonSimpleStepTest {
28
30
@@ -72,12 +74,16 @@ void handlesObjectWithNull() {
72
74
}
73
75
74
76
@ Test
77
+ @ Disabled
78
+ @ ForLintRefactor
75
79
void handlesInvalidJson () {
76
80
stepHarness .testResourceExceptionMsg ("json/invalidJsonBefore.json" )
77
81
.contains ("Expected a ',' or '}' at 9 [character 0 line 3]" );
78
82
}
79
83
80
84
@ Test
85
+ @ Disabled
86
+ @ ForLintRefactor
81
87
void handlesNotJson () {
82
88
stepHarness .testResourceExceptionMsg ("json/notJsonBefore.json" )
83
89
.contains ("Unable to determine JSON type, expected a '{' or '[' but found '#'" );
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2022-2023 DiffPlug
2
+ * Copyright 2022-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
18
18
import java .io .File ;
19
19
20
20
import org .assertj .core .api .Assertions ;
21
+ import org .junit .jupiter .api .Disabled ;
21
22
import org .junit .jupiter .api .Test ;
22
23
23
24
import com .diffplug .spotless .FormatterStep ;
24
25
import com .diffplug .spotless .Provisioner ;
25
26
import com .diffplug .spotless .StepHarness ;
26
27
import com .diffplug .spotless .TestProvisioner ;
27
28
import com .diffplug .spotless .json .JsonFormatterStepCommonTests ;
29
+ import com .diffplug .spotless .tag .ForLintRefactor ;
28
30
29
31
public class GsonStepTest extends JsonFormatterStepCommonTests {
30
32
@@ -41,6 +43,8 @@ void handlesObjectWithNull() {
41
43
}
42
44
43
45
@ Test
46
+ @ Disabled
47
+ @ ForLintRefactor
44
48
void handlesInvalidJson () {
45
49
getStepHarness ().testResourceExceptionMsg ("json/invalidJsonBefore.json" ).isEqualTo ("End of input at line 3 column 1 path $.a" );
46
50
}
You can’t perform that action at this time.
0 commit comments