@@ -69,7 +69,11 @@ void parsing_git_diff_output_works() throws IOException {
6969 @ MethodSource ("getFormatters" )
7070 void reformat_a_subpath_of_a_git_directory_for_only_changed_lines (FormatterService formatterService )
7171 throws IOException , InterruptedException {
72- initRepo ();
72+ runCommandInRepo ("git" , "init" );
73+ runCommandInRepo ("git" , "config" , "user.name" , "Test User" );
74+ runCommandInRepo ("git" , "config" , "user.email" , "test-user@palantir.com" );
75+ runCommandInRepo ("git" , "config" , "commit.gpgsign" , "false" );
76+ runCommandInRepo ("git" , "commit" , "--allow-empty" , "-m" , "Init" );
7377
7478 Path subdir = repo .resolve ("subdir" );
7579 Files .createDirectories (subdir );
@@ -88,52 +92,6 @@ void reformat_a_subpath_of_a_git_directory_for_only_changed_lines(FormatterServi
8892 assertThat (dontTouchMe ).hasContent (" class DontTouchMe {}" );
8993 }
9094
91- @ ParameterizedTest
92- @ MethodSource ("getFormatters" )
93- void reflows_the_long_strings_of_changed_lines_only (FormatterService formatterService )
94- throws IOException , InterruptedException {
95- initRepo ();
96- String outside = " String outside = \" Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris"
97- + " nisi ut aliquip ex ea commodo consequat sed.\" ;" ;
98- Path longStrings = repo .resolve ("LongStrings.java" );
99- Files .write (longStrings , List .of ("class LongStrings {" , outside , "}" ), UTF_8 );
100- runCommandInRepo ("git" , "add" , "." );
101- runCommandInRepo ("git" , "commit" , "-m" , "A long string" );
102-
103- Files .write (
104- longStrings ,
105- List .of (
106- "class LongStrings {" ,
107- outside ,
108- "" ,
109- " String changed = \" Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"
110- + " tempor incididunt ut labore et dolore magna.\" ;" ,
111- "}" ),
112- UTF_8 );
113-
114- FormatDiff .formatDiff (repo , formatterService );
115-
116- assertThat (longStrings )
117- .hasContent (String .join (
118- "\n " ,
119- "class LongStrings {" ,
120- outside ,
121- "" ,
122- " String changed =" ,
123- " \" Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor"
124- + " incididunt ut labore et\" " ,
125- " + \" dolore magna.\" ;" ,
126- "}" ));
127- }
128-
129- private void initRepo () throws IOException , InterruptedException {
130- runCommandInRepo ("git" , "init" );
131- runCommandInRepo ("git" , "config" , "user.name" , "Test User" );
132- runCommandInRepo ("git" , "config" , "user.email" , "test-user@palantir.com" );
133- runCommandInRepo ("git" , "config" , "commit.gpgsign" , "false" );
134- runCommandInRepo ("git" , "commit" , "--allow-empty" , "-m" , "Init" );
135- }
136-
13795 private void runCommandInRepo (String ... args ) throws IOException , InterruptedException {
13896 Process process =
13997 new ProcessBuilder ().command (args ).directory (repo .toFile ()).start ();
@@ -149,9 +107,6 @@ private void runCommandInRepo(String... args) throws IOException, InterruptedExc
149107
150108 private static Stream <FormatterService > getFormatters () throws IOException {
151109 return Stream .of (
152- // In this JVM, as formatDiff runs it without the native binary.
153- FormatterServiceLoader .load (
154- getClasspath ().stream ().map (Path ::toFile ).toList ()),
155110 new BootstrappingFormatterService (
156111 javaBinPath (), Runtime .version ().feature (), getClasspath ()),
157112 new NativeImageFormatterService (
0 commit comments