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 ;
16+ import static org .junit .jupiter .api .Assertions .*;
17+ import static org .junit .jupiter .api .Assumptions .*;
2218
2319import java .io .ByteArrayInputStream ;
2420import java .io .ByteArrayOutputStream ;
@@ -138,8 +134,9 @@ public void testWorkspaceEdit_CreateAndPopulateFile() throws Exception {
138134 String uri = file .getLocation ().toFile ().toURI ().toString ();
139135 edits .add (Either .forRight (new CreateFile (uri )));
140136 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" )))));
137+ new TextDocumentEdit (new VersionedTextDocumentIdentifier (uri , null ),
138+ List .of (Either .forLeft (
139+ new TextEdit (new Range (new Position (0 , 0 ), new Position (0 , 0 )), "abcHere\n abcHere2" ))))));
143140 final var workspaceEdit = new WorkspaceEdit (edits );
144141 // they should be applied from bottom to top
145142 LSPEclipseUtils .applyWorkspaceEdit (workspaceEdit );
@@ -358,8 +355,8 @@ public void testResourceOperations() throws Exception {
358355 assertTrue (targetFile .exists ());
359356 LSPEclipseUtils .applyWorkspaceEdit (new WorkspaceEdit (List .of (Either .forLeft (
360357 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" )))))));
358+ List .of (Either . forLeft (
359+ new TextEdit (new Range (new Position (0 , 0 ), new Position (0 , 0 )), "hello" )))))))) ;
363360 assertEquals ("hello" , readContent (targetFile ));
364361 IFile otherFile = project .getFile ("another/folder/file.lol" );
365362 LSPEclipseUtils .applyWorkspaceEdit (new WorkspaceEdit (List .of (Either .forRight (
@@ -388,7 +385,7 @@ public void editExternalFile() throws Exception {
388385 te .setNewText ("abc\n def" );
389386 final var docEdit = new TextDocumentEdit (
390387 new VersionedTextDocumentIdentifier (file .toURI ().toString (), null ),
391- List .of (te ));
388+ List .of (Either . forLeft ( te ) ));
392389 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
393390 LSPEclipseUtils .applyWorkspaceEdit (we );
394391 assertTrue (file .isFile ());
@@ -428,7 +425,7 @@ public void testTextEditDoesntAutomaticallySaveOpenResourceFiles() throws Except
428425 te .setNewText ("abc\n def" );
429426 final var docEdit = new TextDocumentEdit (
430427 new VersionedTextDocumentIdentifier (LSPEclipseUtils .toUri (targetFile ).toString (), null ),
431- List .of (te ));
428+ List .of (Either . forLeft ( te ) ));
432429 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
433430 LSPEclipseUtils .applyWorkspaceEdit (we );
434431 assertEquals ("abc\n def" , ((StyledText ) ((AbstractTextEditor ) editor ).getAdapter (Control .class )).getText ());
@@ -444,7 +441,7 @@ public void testTextEditDoesntAutomaticallySaveOpenExternalFiles() throws Except
444441 te .setNewText ("abc\n def" );
445442 final var docEdit = new TextDocumentEdit (
446443 new VersionedTextDocumentIdentifier (file .toURI ().toString (), null ),
447- List .of (te ));
444+ List .of (Either . forLeft ( te ) ));
448445 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
449446 LSPEclipseUtils .applyWorkspaceEdit (we );
450447 assertEquals ("abc\n def" , ((StyledText ) ((AbstractTextEditor ) editor ).getAdapter (Control .class )).getText ());
0 commit comments