Skip to content

test: improve exception handling coverage for MoreUnitWizardPageOne - #383

Merged
RoiSoleil merged 3 commits into
masterfrom
fix/logging-and-exception-test-7348121160923334048
Sep 14, 2026
Merged

test: improve exception handling coverage for MoreUnitWizardPageOne#383
RoiSoleil merged 3 commits into
masterfrom
fix/logging-and-exception-test-7348121160923334048

Conversation

@RoiSoleil

Copy link
Copy Markdown
Contributor

Coverage Delta: Improved line/branch coverage for exception handling in MoreUnitWizardPageOne by adding a new test method.
Tested Classes: MoreUnitWizardPageOne, LogHandler
Newly Covered Branches: The JavaModelException catch block in resolveClassNameToType.
Edge Cases Added: Handling of JavaModelException when searching for an IType in a simulated workspace.
Rationale for mocking choices: We mock IJavaProject to throw JavaModelException simulating when the workspace project layout causes a search failure. We avoided mocking Eclipse singletons by replacing JUnitCorePlugin.log with MoreUnit's natively-testable LogHandler.
Eclipse runtime limitations encountered: JUnitCorePlugin.log and JUnitPlugin.log rely on internal Eclipse Platform active-workspace logging states which throw NullPointerExceptions during headless JUnit 5 tests. Refactored the production code to use org.moreunit.log.LogHandler to make testing in Tyco headless mode viable.


PR created automatically by Jules for task 7348121160923334048 started by @RoiSoleil

Co-authored-by: RoiSoleil <3462260+RoiSoleil@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

…test

WorkspaceSourceFolderContentProviderTest swapped the singleton logger for a
mock throwing on any error() call, without ever restoring it. Depending on
the test class execution order (different on Windows CI), later tests such as
PluginToolsTest then failed with "error must not get thrown on closed
projects" when production code legitimately logged an exception.
…ation

The previous test expected resolveClassNameToType to return null on
JavaModelException, but that method propagates the exception by design: the
catch (and logging) happens in its callers. The new test triggers the failure
through superClassChanged() with a mocked package fragment root and asserts
that the status is still OK and the error was logged through LogHandler.
@RoiSoleil
RoiSoleil merged commit 7358d2c into master Sep 14, 2026
10 checks passed
@RoiSoleil
RoiSoleil deleted the fix/logging-and-exception-test-7348121160923334048 branch September 14, 2026 12:13
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