Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Change java version to 17 for robolectric-extension tests #83

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

warnyul
Copy link
Member

@warnyul warnyul commented Aug 5, 2024

  • adding an integration test to test with java 11

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated directory for Java 11 integration tests to enhance testing processes.
    • Added support for Java 11 code coverage in the testing framework.
    • Integrated a new test suite specifically for Java 11 within the project structure.
  • Improvements

    • Enhanced project configuration for better compatibility with Java 11 in the Android compilation process.
    • Streamlined testing setup with the integration of Robolectric and JUnit 5 for effective Android context testing.
  • Chores

    • Updated project settings to include necessary configurations for Java 11 compatibility.

- adding an integration test to test with java 11
@warnyul warnyul self-assigned this Aug 5, 2024
Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Walkthrough

The recent changes introduce support for Java 11 in an Android project, enhancing testing capabilities by configuring a dedicated integration test setup. Key updates include the addition of a new Gradle module for Java 11 tests, integration of essential plugins, and enhancements to code coverage and static analysis tools. These updates aim to improve compatibility and maintainability while ensuring robust testing across different versions of Android.

Changes

Files Change Summary
.idea/gradle.xml Added a path for Java 11 integration tests to enhance project configuration.
build.gradle Included kover(project(':integration-tests:java-11')) to enhance code coverage for Java 11 tests.
gradle/libs.versions.toml Added androidCompileSdkJava11 = "33" and removed androidGradle, clarifying Java 11 dependency.
integration-tests/java-11/build.gradle Established configuration for Java 11 integration tests, integrating plugins for coverage and analysis.
integration-tests/java-11/src/test/kotlin/.../Java11Test.kt Created a test class for JUnit 5 and Robolectric to validate Android app context setup.
robolectric-extension/build.gradle Introduced javaLauncher in the test configuration for enhanced test execution with Java toolchains.
settings.gradle Included integration-tests:java-11 to expand dependency management for Java 11 testing.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant CI/CD
    participant Test Environment
    participant Code Coverage Tool

    Developer->>CI/CD: Commit changes for Java 11 support
    CI/CD->>Test Environment: Trigger integration tests
    Test Environment->>Code Coverage Tool: Collect coverage data
    Code Coverage Tool-->>Test Environment: Provide coverage report
    Test Environment-->>CI/CD: Send test results
    CI/CD-->>Developer: Notify test outcome
Loading

Poem

🐇 In a world of Java, bright and new,
A rabbit hops, with joy anew.
Integration tests, oh what a delight,
With plugins and coverage, we reach new heights!
Hopping through code, ensuring it's right,
For every little bug, we’ll put up a fight! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@warnyul warnyul changed the title build: Change java version to 17 for robolectric-extension tests test: Change java version to 17 for robolectric-extension tests Aug 5, 2024
@warnyul warnyul changed the title test: Change java version to 17 for robolectric-extension tests build: Change java version to 17 for robolectric-extension tests Aug 5, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 488468c and 5d48c60.

Files selected for processing (7)
  • .idea/gradle.xml (2 hunks)
  • build.gradle (1 hunks)
  • gradle/libs.versions.toml (2 hunks)
  • integration-tests/java-11/build.gradle (1 hunks)
  • integration-tests/java-11/src/test/kotlin/tech/apter/junit/jupiter/robolectric/integration/tests/java11/Java11Test.kt (1 hunks)
  • robolectric-extension/build.gradle (1 hunks)
  • settings.gradle (1 hunks)
Files skipped from review due to trivial changes (1)
  • settings.gradle
Additional comments not posted (11)
build.gradle (1)

22-22: Dependency addition for Java 11 integration tests.

The addition of kover(project(':integration-tests:java-11')) appears correct and aligns with the objective of adding Java 11 integration tests. Ensure that the integration-tests:java-11 project is correctly configured and that this dependency does not introduce any conflicts.

integration-tests/java-11/src/test/kotlin/tech/apter/junit/jupiter/robolectric/integration/tests/java11/Java11Test.kt (1)

1-18: New test class for Java 11 integration.

The test class Java11Test is well-structured and correctly uses the RobolectricExtension and @Config annotation to specify the SDK version. The test method Given an android project with kotlin-dsl build script when using Robolectric with JUnit5 the android app should be available verifies that the Android application context is available, which is a valid test for this scenario.

integration-tests/java-11/build.gradle (5)

1-7: Plugins configuration for Java 11 integration tests.

The plugins configuration includes necessary plugins for Android, Kotlin, Kover, Detekt, and the Robolectric extension. This setup appears comprehensive and appropriate for the integration tests.


9-22: Android configuration for Java 11 integration tests.

The Android configuration specifies the namespace, compile SDK version, build tools version, and minimum SDK version. The testOptions block configures the enabled SDKs for Robolectric, which is essential for testing across different Android versions. This configuration is well-defined and aligns with best practices.


25-28: Detekt configuration for Java 11 integration tests.

The Detekt configuration specifies the tool version and enables auto-correct. This setup ensures that code quality is maintained and adheres to the defined rules.


30-32: Kotlin configuration for Java 11 integration tests.

The Kotlin configuration specifies the JVM toolchain version, which is necessary for ensuring compatibility with the specified Java version.


34-37: Dependencies for Java 11 integration tests.

The dependencies include Detekt plugins for formatting and rules libraries. This setup ensures that the code adheres to the defined style and quality rules.

.idea/gradle.xml (1)

28-28: LGTM! Addition of Java 11 integration tests path.

The new entry for Java 11 integration tests is correctly placed within the <option name="modules"> section.

gradle/libs.versions.toml (2)

5-5: LGTM! Addition of androidCompileSdkJava11 version.

The new entry for androidCompileSdkJava11 is correctly placed within the [versions] section.


5-5: LGTM! Removal of androidGradle entry.

The removal of the androidGradle entry from the [libraries] section is appropriate, given the presence of androidGradleJava11.

Also applies to: 5-5

robolectric-extension/build.gradle (1)

42-48: LGTM! Addition of javaLauncher configuration.

The new configuration block within the test task sets the javaLauncher using a Java toolchain, enhancing the flexibility of the testing setup.

Copy link

github-actions bot commented Aug 5, 2024

Branch Coverage (ubuntu-22.04)

Total Project Coverage 69.91%

Copy link

github-actions bot commented Aug 5, 2024

Line Coverage (ubuntu-22.04)

Total Project Coverage 92.05%

Copy link

github-actions bot commented Aug 5, 2024

Branch Coverage (windows-2022)

Total Project Coverage 69.91%

Copy link

github-actions bot commented Aug 5, 2024

Line Coverage (windows-2022)

Total Project Coverage 92.05%

@warnyul warnyul merged commit b816ee7 into main Aug 5, 2024
9 checks passed
@warnyul warnyul deleted the change-jvm-target-for-tests branch August 5, 2024 10:10
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.

1 participant