Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public final class HostSystem {
private final String operatingSystem;
private final String cpuArchitecture;
private final String pathSeparator;
private final Path workingDirectory;
private final Path javaHome;
private final String javaVendor;
private final List<Path> path;
Expand All @@ -72,7 +71,6 @@ public HostSystem(Properties properties, Function<String, String> envProvider) {
operatingSystem = properties.getProperty("os.name", "");
cpuArchitecture = properties.getProperty("os.arch", "");
pathSeparator = properties.getProperty("path.separator", "");
workingDirectory = FileUtils.normalize(Path.of(""));
javaHome = FileUtils.normalize(Path.of(properties.getProperty("java.home", "")));
javaVendor = properties.getProperty("java.vendor", "");
path = parsePath(requireNonNullElse(envProvider.apply("PATH"), ""), pathSeparator);
Expand Down Expand Up @@ -103,10 +101,6 @@ public boolean isProbablyWindows() {
return operatingSystem.toLowerCase(Locale.ROOT).startsWith("windows");
}

public Path getWorkingDirectory() {
return workingDirectory;
}

public Path getJavaExecutablePath() {
return javaHome.resolve("bin").resolve(isProbablyWindows() ? "java.exe" : "java");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,22 +215,6 @@ void isProbablyTermuxReturnsTheExpectedResults(
assertThat(actualResult).isEqualTo(expectedResult);
}

@DisplayName(".getWorkingDirectory() returns the working directory")
@Test
void getWorkingDirectoryReturnsTheWorkingDirectory() {
// Given
var hostSystemBean = new HostSystem();

// When
var actualWorkingDirectory = hostSystemBean.getWorkingDirectory();

// Then
assertThat(actualWorkingDirectory)
.isNormalized()
.isAbsolute()
.isEqualTo(Path.of("").toAbsolutePath().normalize());
}

@DisplayName(".getJavaExecutablePath() returns the Java executable")
@CsvSource({
" Windows, java.exe",
Expand Down