Skip to content

add new tests - #90

Merged
e-kotov merged 2 commits into
mainfrom
test-cov
Dec 8, 2025
Merged

add new tests#90
e-kotov merged 2 commits into
mainfrom
test-cov

Conversation

@e-kotov

@e-kotov e-kotov commented Dec 8, 2025

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 8, 2025 16:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive test coverage for the rJavaEnv package by introducing 10 new test files that cover various aspects of the package functionality, including Java installation, environment management, build environment configuration, and internal utilities.

Key Changes

  • Added extensive unit tests with mocked dependencies to avoid network calls and system dependencies
  • Introduced tests for .onLoad, Java wrappers, Java management, environment configuration, and internal utilities
  • Updated RoxygenNote version from 7.3.2 to 7.3.3

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/testthat/test-onLoad.R Tests for package initialization, verifying that .onLoad sets default options correctly
tests/testthat/test-java_wrappers.R Tests for java_quick_install() and use_java() wrapper functions with mocked dependencies
tests/testthat/test-java_manage.R Tests for java_list() and java_clear() functions covering different dispatching scenarios and user input handling
tests/testthat/test-java_env_unit.R Unit tests for java_env_set() and java_env_unset() with comprehensive mocking of system calls
tests/testthat/test-java_env_linux.R Platform-specific tests for Java environment setup on Linux systems
tests/testthat/test-java_build_env_extra.R Additional tests for build environment management including .Rprofile manipulation
tests/testthat/test-java_build_env.R Tests for java_build_env_set() covering session, project, and combined modes
tests/testthat/test-internal_utilities_version.R Tests for Java version parsing and detection utilities with various version string formats
tests/testthat/test-internal_utilities_extra.R Tests for URL loading and testing utilities
tests/testthat/test-internal_utilities.R Tests for platform detection, consent management, and environment variable utilities
DESCRIPTION Updates RoxygenNote version to 7.3.3

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# Mock installed.packages to avoid rJava checks
local_mocked_bindings(
installed.packages = function(...) matrix(character(0), nrow=0, ncol=2),

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spacing around = in function arguments. The rest of the codebase uses spaces around = (e.g., nrow = 0, ncol = 2 as seen in test-java_env_unit.R lines 13, 51, 87). This should be nrow = 0, ncol = 2 for consistency.

Suggested change
installed.packages = function(...) matrix(character(0), nrow=0, ncol=2),
installed.packages = function(...) matrix(character(0), nrow = 0, ncol = 2),

Copilot uses AI. Check for mistakes.
test_that("java_env_set_session warns if rJava is already loaded", {
# Mock installed.packages to say rJava is installed
local_mocked_bindings(
installed.packages = function() matrix(c("rJava"), dimnames=list(NULL, "Package")),

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spacing around = in function arguments. The rest of the codebase uses spaces around = (e.g., nrow = 0, ncol = 2 as seen in test-java_env_unit.R). This should be dimnames = list(NULL, "Package") for consistency.

Suggested change
installed.packages = function() matrix(c("rJava"), dimnames=list(NULL, "Package")),
installed.packages = function() matrix(c("rJava"), dimnames = list(NULL, "Package")),

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Dec 8, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 65.40%. Comparing base (2fa6f53) to head (4a9798a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
R/java_build_env.R 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #90       +/-   ##
===========================================
+ Coverage   34.76%   65.40%   +30.63%     
===========================================
  Files          15       15               
  Lines        1237     1237               
===========================================
+ Hits          430      809      +379     
+ Misses        807      428      -379     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@e-kotov
e-kotov merged commit bae39a3 into main Dec 8, 2025
9 of 11 checks passed
@e-kotov
e-kotov deleted the test-cov branch December 8, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants