1414import static org .junit .jupiter .api .Assertions .assertTrue ;
1515
1616import java .io .File ;
17+ import java .nio .charset .Charset ;
1718import java .util .Iterator ;
1819import java .util .List ;
1920import java .util .Optional ;
2627import org .eclipse .lsp4j .WorkspaceSymbol ;
2728import org .junit .jupiter .api .BeforeEach ;
2829import org .junit .jupiter .api .Test ;
30+ import org .junit .jupiter .api .condition .DisabledOnOs ;
31+ import org .junit .jupiter .api .condition .OS ;
2932import org .junit .jupiter .api .extension .ExtendWith ;
3033import org .springframework .beans .factory .annotation .Autowired ;
3134import org .springframework .context .annotation .Import ;
@@ -81,6 +84,8 @@ void testSimpleRequestMappingSymbol() throws Exception {
8184 }
8285
8386 @ Test
87+ //TODO: Enable when JDT Core 3.41 or higher is adopted. See: https://github.com/eclipse-jdt/eclipse.jdt.core/pull/3416
88+ @ DisabledOnOs (OS .WINDOWS )
8489 void testSimpleRequestMappingSymbolFromConstantInDifferentClass () throws Exception {
8590 String docUri = directory .toPath ().resolve ("src/main/java/org/test/SimpleMappingClassWithConstantInDifferentClass.java" ).toUri ().toString ();
8691 String constantsUri = directory .toPath ().resolve ("src/main/java/org/test/Constants.java" ).toUri ().toString ();
@@ -95,7 +100,7 @@ void testSimpleRequestMappingSymbolFromConstantInDifferentClass() throws Excepti
95100 TestFileScanListener fileScanListener = new TestFileScanListener ();
96101 indexer .getJavaIndexer ().setFileScanListener (fileScanListener );
97102
98- CompletableFuture <Void > updateFuture = indexer .updateDocument (constantsUri , FileUtils .readFileToString (UriUtil .toFile (constantsUri )), "test triggered" );
103+ CompletableFuture <Void > updateFuture = indexer .updateDocument (constantsUri , FileUtils .readFileToString (UriUtil .toFile (constantsUri ), Charset . defaultCharset () ), "test triggered" );
99104 updateFuture .get (5 , TimeUnit .SECONDS );
100105
101106 fileScanListener .assertScannedUris (constantsUri , docUri );
@@ -104,6 +109,8 @@ void testSimpleRequestMappingSymbolFromConstantInDifferentClass() throws Excepti
104109 }
105110
106111 @ Test
112+ //TODO: Enable when JDT Core 3.41 or higher is adopted. See: https://github.com/eclipse-jdt/eclipse.jdt.core/pull/3416
113+ @ DisabledOnOs (OS .WINDOWS )
107114 void testUpdateDocumentWithConstantFromDifferentClass () throws Exception {
108115 String docUri = directory .toPath ().resolve ("src/main/java/org/test/SimpleMappingClassWithConstantInDifferentClass.java" ).toUri ().toString ();
109116 String constantsUri = directory .toPath ().resolve ("src/main/java/org/test/Constants.java" ).toUri ().toString ();
@@ -118,7 +125,7 @@ void testUpdateDocumentWithConstantFromDifferentClass() throws Exception {
118125 TestFileScanListener fileScanListener = new TestFileScanListener ();
119126 indexer .getJavaIndexer ().setFileScanListener (fileScanListener );
120127
121- CompletableFuture <Void > updateFuture = indexer .updateDocument (docUri , FileUtils .readFileToString (UriUtil .toFile (docUri )), "test triggered" );
128+ CompletableFuture <Void > updateFuture = indexer .updateDocument (docUri , FileUtils .readFileToString (UriUtil .toFile (docUri ), Charset . defaultCharset () ), "test triggered" );
122129 updateFuture .get (5 , TimeUnit .SECONDS );
123130
124131 assertEquals (ImmutableSet .of ("Lorg/test/Constants;" ), dt .getAllDependencies ().get (UriUtil .toFileString (docUri )));
@@ -129,6 +136,8 @@ void testUpdateDocumentWithConstantFromDifferentClass() throws Exception {
129136 }
130137
131138 @ Test
139+ //TODO: Enable when JDT Core 3.41 or higher is adopted. See: https://github.com/eclipse-jdt/eclipse.jdt.core/pull/3416
140+ @ DisabledOnOs (OS .WINDOWS )
132141 void testCyclicalRequestMappingDependency () throws Exception {
133142 //Cyclical dependency:
134143 //file a => file b => file a
@@ -352,7 +361,7 @@ private void assertSymbol(String docUri, String name, String coveredText) throws
352361 assertTrue (maybeSymbol .isPresent ());
353362
354363 TextDocument doc = new TextDocument (docUri , LanguageId .JAVA );
355- doc .setText (FileUtils .readFileToString (UriUtil .toFile (docUri )));
364+ doc .setText (FileUtils .readFileToString (UriUtil .toFile (docUri ), Charset . defaultCharset () ));
356365
357366 WorkspaceSymbol symbol = maybeSymbol .get ();
358367 Location loc = symbol .getLocation ().getLeft ();
0 commit comments