File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
core/src/test/java/org/elasticsearch/plugins
qa/no-bootstrap-tests/src/test/java/org/elasticsearch/bootstrap Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 3030import java .io .IOException ;
3131import java .nio .file .FileSystemException ;
3232import java .nio .file .Files ;
33+ import java .nio .file .NoSuchFileException ;
3334import java .nio .file .Path ;
3435import java .util .Arrays ;
3536import java .util .Collection ;
@@ -145,7 +146,11 @@ public void testDesktopServicesStoreFiles() throws IOException {
145146 assertThat (e , hasToString (containsString ("Could not load plugin descriptor for existing plugin [.DS_Store]" )));
146147 assertNotNull (e .getCause ());
147148 assertThat (e .getCause (), instanceOf (FileSystemException .class ));
148- assertThat (e .getCause (), hasToString (containsString ("Not a directory" )));
149+ if (Constants .WINDOWS ) {
150+ assertThat (e .getCause (), instanceOf (NoSuchFileException .class ));
151+ } else {
152+ assertThat (e .getCause (), hasToString (containsString ("Not a directory" )));
153+ }
149154 }
150155 }
151156
Original file line number Diff line number Diff line change 3333import java .nio .charset .StandardCharsets ;
3434import java .nio .file .FileSystemException ;
3535import java .nio .file .Files ;
36+ import java .nio .file .NoSuchFileException ;
3637import java .nio .file .Path ;
3738import java .nio .file .attribute .PosixFileAttributeView ;
3839import java .nio .file .attribute .PosixFilePermission ;
4546import static org .hamcrest .Matchers .equalTo ;
4647import static org .hamcrest .Matchers .hasSize ;
4748import static org .hamcrest .Matchers .hasToString ;
49+ import static org .hamcrest .Matchers .instanceOf ;
4850
4951/**
5052 * Create a simple "daemon controller", put it in the right place and check that it runs.
@@ -211,7 +213,11 @@ public void testSpawnerHandlingOfDesktopServicesStoreFiles() throws IOException
211213 // we do not ignore these files on non-macOS systems
212214 final FileSystemException e =
213215 expectThrows (FileSystemException .class , () -> spawner .spawnNativePluginControllers (environment ));
214- assertThat (e , hasToString (containsString ("Not a directory" )));
216+ if (Constants .WINDOWS ) {
217+ assertThat (e , instanceOf (NoSuchFileException .class ));
218+ } else {
219+ assertThat (e , hasToString (containsString ("Not a directory" )));
220+ }
215221 }
216222 }
217223
You can’t perform that action at this time.
0 commit comments