1
+ /*
2
+ * Copyright 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
+ */
1
16
package com .diffplug .spotless .java ;
2
17
3
18
import java .io .File ;
4
19
import java .nio .charset .StandardCharsets ;
20
+
5
21
import org .junit .jupiter .api .Assertions ;
6
22
import org .junit .jupiter .api .Test ;
23
+
7
24
import com .diffplug .common .io .Files ;
8
25
import com .diffplug .spotless .FormatterStep ;
9
26
import com .diffplug .spotless .ResourceHarness ;
@@ -24,8 +41,7 @@ void name() throws Exception {
24
41
@ Test
25
42
void notFormattings () throws Exception {
26
43
File cleanFile = newFile ("clean.java" );
27
- String cleanJava =
28
- ResourceHarness .getTestResource ("java/idea/full.clean.java" );
44
+ String cleanJava = ResourceHarness .getTestResource ("java/idea/full.clean.java" );
29
45
Files .write (cleanJava , cleanFile , StandardCharsets .UTF_8 );
30
46
FormatterStep step = IdeaStep .create (true , "idea" );
31
47
@@ -38,8 +54,7 @@ void notFormattings() throws Exception {
38
54
@ Test
39
55
void formattings () throws Exception {
40
56
File dirtyFile = newFile ("dirty.java" );
41
- String dirtyJava =
42
- ResourceHarness .getTestResource ("java/idea/full.dirty.java" );
57
+ String dirtyJava = ResourceHarness .getTestResource ("java/idea/full.dirty.java" );
43
58
Files .write (dirtyJava , dirtyFile , StandardCharsets .UTF_8 );
44
59
FormatterStep step = IdeaStep .create (true , "idea" );
45
60
@@ -52,8 +67,7 @@ void formattings() throws Exception {
52
67
@ Test
53
68
void formattingsWorkWithDefaultParameters () throws Exception {
54
69
File dirtyFile = newFile ("dirty.java" );
55
- String dirtyJava =
56
- ResourceHarness .getTestResource ("java/idea/full.dirty.java" );
70
+ String dirtyJava = ResourceHarness .getTestResource ("java/idea/full.dirty.java" );
57
71
Files .write (dirtyJava , dirtyFile , StandardCharsets .UTF_8 );
58
72
FormatterStep step = IdeaStep .create ();
59
73
@@ -66,8 +80,7 @@ void formattingsWorkWithDefaultParameters() throws Exception {
66
80
@ Test
67
81
void formattingsWithOutDefaultDoesNothing () throws Exception {
68
82
File dirtyFile = newFile ("dirty.java" );
69
- String dirtyJava =
70
- ResourceHarness .getTestResource ("java/idea/full.dirty.java" );
83
+ String dirtyJava = ResourceHarness .getTestResource ("java/idea/full.dirty.java" );
71
84
Files .write (dirtyJava , dirtyFile , StandardCharsets .UTF_8 );
72
85
FormatterStep step = IdeaStep .create (false , "idea" );
73
86
@@ -80,8 +93,7 @@ void formattingsWithOutDefaultDoesNothing() throws Exception {
80
93
@ Test
81
94
void configureFile () throws Exception {
82
95
File cleanFile = newFile ("clean.java" );
83
- String cleanJava =
84
- ResourceHarness .getTestResource ("java/idea/full.clean.java" );
96
+ String cleanJava = ResourceHarness .getTestResource ("java/idea/full.clean.java" );
85
97
Files .write (cleanJava , cleanFile , StandardCharsets .UTF_8 );
86
98
FormatterStep step = IdeaStep .create (true , "idea" );
87
99
0 commit comments