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

Java: Add integration test for failure to download a particular Maven version #18836

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Feb 21, 2025

No description provided.

@Copilot Copilot bot review requested due to automatic review settings February 21, 2025 18:34
@smowton smowton requested a review from a team as a code owner February 21, 2025 18:34
@github-actions github-actions bot added the Java label Feb 21, 2025

Choose a reason for hiding this comment

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

PR Overview

This pull request adds an integration test to simulate a failure when downloading an incorrect Maven version and verifies that the application exits with an error.

  • Added a basic unit test in AppTest.java as a placeholder integration test.
  • Implemented Maven version and command line validation in App.java with error messages and exit conditions.
  • Included a Python helper script (test.py) to create a CodeQL database using a custom environment.

Reviewed Changes

File Description
java/ql/integration-tests/java/maven-download-failure/src/test/java/com/example/AppTest.java Added a simple test case.
java/ql/integration-tests/java/maven-download-failure/src/main/java/com/example/App.java Added validation logic for Maven version and command line arguments with error messages on failure.
java/ql/integration-tests/java/maven-download-failure/test.py Introduced a Python script to set up the test environment.

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

java/ql/integration-tests/java/maven-download-failure/src/main/java/com/example/App.java:20

  • [nitpick] Consider revising the error message formatting to clearly separate the observed Maven version from the mavenHome path, for example by adding a separator or explicit label for the home directory.
System.err.println("Wrong maven version, expected '" + expectedVersion + "' but got '" + observedVersion + "'" + mavenHome);

java/ql/integration-tests/java/maven-download-failure/src/test/java/com/example/AppTest.java:16

  • [nitpick] The test method name 'shouldAnswerWithTrue' is generic; consider renaming it to reflect the integration test's intent, for instance 'testMavenVersionMismatch'.
public void shouldAnswerWithTrue()

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant