Java: Add integration test for failure to download a particular Maven version#18836
Merged
smowton merged 4 commits intogithub:mainfrom Mar 12, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
0534a40 to
a24f991
Compare
42071ef to
6b6db2d
Compare
igfoo
approved these changes
Mar 7, 2025
6b6db2d to
55c3650
Compare
55c3650 to
4205d5e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.