1313 *******************************************************************************/
1414package org .eclipse .lsp4e .test .edit ;
1515
16- import static org .junit .jupiter .api .Assertions .assertEquals ;
17- import static org .junit .jupiter .api .Assertions .assertFalse ;
18- import static org .junit .jupiter .api .Assertions .assertNotEquals ;
19- import static org .junit .jupiter .api .Assertions .assertNotNull ;
20- import static org .junit .jupiter .api .Assertions .assertNull ;
21- import static org .junit .jupiter .api .Assertions .assertTrue ;
22- import static org .junit .jupiter .api .Assumptions .assumeFalse ;
23- import static org .junit .jupiter .api .Assumptions .assumeTrue ;
16+ import static org .junit .jupiter .api .Assertions .*;
17+ import static org .junit .jupiter .api .Assumptions .*;
2418
2519import java .io .ByteArrayInputStream ;
2620import java .io .ByteArrayOutputStream ;
@@ -138,8 +132,9 @@ public void testWorkspaceEdit_CreateAndPopulateFile() throws Exception {
138132 String uri = file .getLocation ().toFile ().toURI ().toString ();
139133 edits .add (Either .forRight (new CreateFile (uri )));
140134 edits .add (Either .forLeft (
141- new TextDocumentEdit (new VersionedTextDocumentIdentifier (uri , null ), List .of (
142- new TextEdit (new Range (new Position (0 , 0 ), new Position (0 , 0 )), "abcHere\n abcHere2" )))));
135+ new TextDocumentEdit (new VersionedTextDocumentIdentifier (uri , null ),
136+ List .of (Either .forLeft (
137+ new TextEdit (new Range (new Position (0 , 0 ), new Position (0 , 0 )), "abcHere\n abcHere2" ))))));
143138 final var workspaceEdit = new WorkspaceEdit (edits );
144139 // they should be applied from bottom to top
145140 LSPEclipseUtils .applyWorkspaceEdit (workspaceEdit );
@@ -358,8 +353,8 @@ public void testResourceOperations() throws Exception {
358353 assertTrue (targetFile .exists ());
359354 LSPEclipseUtils .applyWorkspaceEdit (new WorkspaceEdit (List .of (Either .forLeft (
360355 new TextDocumentEdit (new VersionedTextDocumentIdentifier (targetFile .getLocationURI ().toString (), 1 ),
361- List .of (
362- new TextEdit (new Range (new Position (0 , 0 ), new Position (0 , 0 )), "hello" )))))));
356+ List .of (Either . forLeft (
357+ new TextEdit (new Range (new Position (0 , 0 ), new Position (0 , 0 )), "hello" )))))))) ;
363358 assertEquals ("hello" , readContent (targetFile ));
364359 IFile otherFile = project .getFile ("another/folder/file.lol" );
365360 LSPEclipseUtils .applyWorkspaceEdit (new WorkspaceEdit (List .of (Either .forRight (
@@ -388,7 +383,7 @@ public void editExternalFile() throws Exception {
388383 te .setNewText ("abc\n def" );
389384 final var docEdit = new TextDocumentEdit (
390385 new VersionedTextDocumentIdentifier (file .toURI ().toString (), null ),
391- List .of (te ));
386+ List .of (Either . forLeft ( te ) ));
392387 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
393388 LSPEclipseUtils .applyWorkspaceEdit (we );
394389 assertTrue (file .isFile ());
@@ -428,7 +423,7 @@ public void testTextEditDoesntAutomaticallySaveOpenResourceFiles() throws Except
428423 te .setNewText ("abc\n def" );
429424 final var docEdit = new TextDocumentEdit (
430425 new VersionedTextDocumentIdentifier (LSPEclipseUtils .toUri (targetFile ).toString (), null ),
431- List .of (te ));
426+ List .of (Either . forLeft ( te ) ));
432427 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
433428 LSPEclipseUtils .applyWorkspaceEdit (we );
434429 assertEquals ("abc\n def" , ((StyledText ) ((AbstractTextEditor ) editor ).getAdapter (Control .class )).getText ());
@@ -444,7 +439,7 @@ public void testTextEditDoesntAutomaticallySaveOpenExternalFiles() throws Except
444439 te .setNewText ("abc\n def" );
445440 final var docEdit = new TextDocumentEdit (
446441 new VersionedTextDocumentIdentifier (file .toURI ().toString (), null ),
447- List .of (te ));
442+ List .of (Either . forLeft ( te ) ));
448443 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
449444 LSPEclipseUtils .applyWorkspaceEdit (we );
450445 assertEquals ("abc\n def" , ((StyledText ) ((AbstractTextEditor ) editor ).getAdapter (Control .class )).getText ());
0 commit comments