Skip to content

Commit

Permalink
feat(#5): Add informative message if we can't find java in bin folder
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Nov 22, 2023
1 parent 45bbbaa commit 2bb925a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/test/java/com/yegor256/JhomeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
*/
package com.yegor256;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.stream.Collectors;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.hamcrest.io.FileMatchers;
Expand Down Expand Up @@ -57,9 +61,14 @@ void findsCorrectHome() {
}

@Test
void findsJavaOnAnyOs() {
void findsJavaOnAnyOs() throws IOException {
MatcherAssert.assertThat(
"java binary file doesn't exist. If you run this test, then you should have a JDK installed",
String.format(
"java binary file doesn't exist. If you run this test, then you should have a JDK installed. All files in bin folder: %n%s",
Files.list(new Jhome().path("bin"))
.map(Path::toString)
.collect(Collectors.joining("\n"))
),
new Jhome().java().toFile(),
FileMatchers.anExistingFile()
);
Expand Down

0 comments on commit 2bb925a

Please sign in to comment.