|
29 | 29 | import java.util.stream.Stream;
|
30 | 30 |
|
31 | 31 | import static java.util.stream.Collectors.joining;
|
| 32 | +import static org.elasticsearch.packaging.util.FileExistenceMatchers.fileDoesNotExist; |
| 33 | +import static org.elasticsearch.packaging.util.FileExistenceMatchers.fileExists; |
32 | 34 | import static org.elasticsearch.packaging.util.FileMatcher.Fileness.Directory;
|
33 | 35 | import static org.elasticsearch.packaging.util.FileMatcher.Fileness.File;
|
34 | 36 | import static org.elasticsearch.packaging.util.FileMatcher.file;
|
|
48 | 50 | import static org.hamcrest.collection.IsEmptyCollection.empty;
|
49 | 51 | import static org.hamcrest.core.Is.is;
|
50 | 52 | import static org.hamcrest.core.IsNot.not;
|
51 |
| -import static org.junit.Assert.assertFalse; |
52 |
| -import static org.junit.Assert.assertTrue; |
53 | 53 |
|
54 | 54 | /**
|
55 | 55 | * Installation and verification logic for archive distributions
|
@@ -269,7 +269,7 @@ public static Shell.Result startElasticsearchWithTty(Installation installation,
|
269 | 269 | public static Shell.Result runElasticsearchStartCommand(Installation installation, Shell sh, String keystorePassword) {
|
270 | 270 | final Path pidFile = installation.home.resolve("elasticsearch.pid");
|
271 | 271 |
|
272 |
| - assertFalse("Pid file doesn't exist when starting Elasticsearch", Files.exists(pidFile)); |
| 272 | + assertThat(pidFile, fileDoesNotExist()); |
273 | 273 |
|
274 | 274 | final Installation.Executables bin = installation.executables();
|
275 | 275 |
|
@@ -339,14 +339,14 @@ public static void assertElasticsearchStarted(Installation installation) throws
|
339 | 339 | final Path pidFile = installation.home.resolve("elasticsearch.pid");
|
340 | 340 | ServerUtils.waitForElasticsearch(installation);
|
341 | 341 |
|
342 |
| - assertTrue("Starting Elasticsearch produced a pid file at " + pidFile, Files.exists(pidFile)); |
| 342 | + assertThat("Starting Elasticsearch produced a pid file at " + pidFile, pidFile, fileExists()); |
343 | 343 | String pid = slurp(pidFile).trim();
|
344 | 344 | assertThat(pid, is(not(emptyOrNullString())));
|
345 | 345 | }
|
346 | 346 |
|
347 | 347 | public static void stopElasticsearch(Installation installation) throws Exception {
|
348 | 348 | Path pidFile = installation.home.resolve("elasticsearch.pid");
|
349 |
| - assertTrue("pid file should exist", Files.exists(pidFile)); |
| 349 | + assertThat(pidFile, fileExists()); |
350 | 350 | String pid = slurp(pidFile).trim();
|
351 | 351 | assertThat(pid, is(not(emptyOrNullString())));
|
352 | 352 |
|
|
0 commit comments