diff --git a/R/selenium.R b/R/selenium.R index 027c050..687b755 100644 --- a/R/selenium.R +++ b/R/selenium.R @@ -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")) } diff --git a/tests/testthat/test-selenium.R b/tests/testthat/test-selenium.R index b7aab50..ce2b7d9 100644 --- a/tests/testthat/test-selenium.R +++ b/tests/testthat/test-selenium.R @@ -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(