Skip to content

Commit

Permalink
Fix missing java runtime (#38)
Browse files Browse the repository at this point in the history
* fix java_check if runtime missing
* fix mock of java_check
  • Loading branch information
jonathanvoelkle authored Oct 11, 2023
1 parent a4c1d7e commit 47e5905
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/selenium.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ java_check <- function() {
if (identical(unname(javapath), "")) {
stop("PATH to JAVA not found. Please check JAVA is installed.")
}
java_version <- suppressWarnings(system2(Sys.which("java"), "-version", stdout = TRUE, stderr = TRUE))
java_version <- suppressWarnings(system2(javapath, "-version", stdout = TRUE, stderr = TRUE))
if (!is.null(attr(java_version, "status"))) {
stop(paste(java_version, collapse = "\n"))
}
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-selenium.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ test_that("errorIfVersionNotFound", {
list_versions = mock_binman_list_versions_selenium,
)
local_mocked_bindings(
Sys.which = function(...) {
java_check = function(...) {
"im here"
},
.package = "base"
)

expect_error(
Expand Down

0 comments on commit 47e5905

Please sign in to comment.