|
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
|
@@ -268,7 +268,7 @@ public static Shell.Result startElasticsearchWithTty(Installation installation,
|
268 | 268 | public static Shell.Result runElasticsearchStartCommand(Installation installation, Shell sh, String keystorePassword) {
|
269 | 269 | final Path pidFile = installation.home.resolve("elasticsearch.pid");
|
270 | 270 |
|
271 |
| - assertFalse("Pid file doesn't exist when starting Elasticsearch", Files.exists(pidFile)); |
| 271 | + assertThat(pidFile, fileDoesNotExist()); |
272 | 272 |
|
273 | 273 | final Installation.Executables bin = installation.executables();
|
274 | 274 |
|
@@ -338,14 +338,14 @@ public static void assertElasticsearchStarted(Installation installation) throws
|
338 | 338 | final Path pidFile = installation.home.resolve("elasticsearch.pid");
|
339 | 339 | ServerUtils.waitForElasticsearch(installation);
|
340 | 340 |
|
341 |
| - assertTrue("Starting Elasticsearch produced a pid file at " + pidFile, Files.exists(pidFile)); |
| 341 | + assertThat("Starting Elasticsearch produced a pid file at " + pidFile, pidFile, fileExists()); |
342 | 342 | String pid = slurp(pidFile).trim();
|
343 | 343 | assertThat(pid, is(not(emptyOrNullString())));
|
344 | 344 | }
|
345 | 345 |
|
346 | 346 | public static void stopElasticsearch(Installation installation) throws Exception {
|
347 | 347 | Path pidFile = installation.home.resolve("elasticsearch.pid");
|
348 |
| - assertTrue("pid file should exist", Files.exists(pidFile)); |
| 348 | + assertThat(pidFile, fileExists()); |
349 | 349 | String pid = slurp(pidFile).trim();
|
350 | 350 | assertThat(pid, is(not(emptyOrNullString())));
|
351 | 351 |
|
|
0 commit comments