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 (
@@ -386,7 +383,7 @@ public void editExternalFile(@TempDir Path tempDir) throws Exception {
386383 te .setNewText ("abc\n def" );
387384 final var docEdit = new TextDocumentEdit (
388385 new VersionedTextDocumentIdentifier (file .toUri ().toString (), null ),
389- List .of (te ));
386+ List .of (Either . forLeft ( te ) ));
390387 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
391388 LSPEclipseUtils .applyWorkspaceEdit (we );
392389 assertTrue (Files .isRegularFile (file ));
@@ -425,7 +422,7 @@ public void testTextEditDoesntAutomaticallySaveOpenResourceFiles() throws Except
425422 te .setNewText ("abc\n def" );
426423 final var docEdit = new TextDocumentEdit (
427424 new VersionedTextDocumentIdentifier (LSPEclipseUtils .toUri (targetFile ).toString (), null ),
428- List .of (te ));
425+ List .of (Either . forLeft ( te ) ));
429426 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
430427 LSPEclipseUtils .applyWorkspaceEdit (we );
431428 assertEquals ("abc\n def" , ((StyledText ) ((AbstractTextEditor ) editor ).getAdapter (Control .class )).getText ());
@@ -441,7 +438,7 @@ public void testTextEditDoesntAutomaticallySaveOpenExternalFiles(@TempDir Path t
441438 te .setNewText ("abc\n def" );
442439 final var docEdit = new TextDocumentEdit (
443440 new VersionedTextDocumentIdentifier (file .toUri ().toString (), null ),
444- List .of (te ));
441+ List .of (Either . forLeft ( te ) ));
445442 final var we = new WorkspaceEdit (List .of (Either .forLeft (docEdit )));
446443 LSPEclipseUtils .applyWorkspaceEdit (we );
447444 assertEquals ("abc\n def" , ((StyledText ) ((AbstractTextEditor ) editor ).getAdapter (Control .class )).getText ());
0 commit comments