Make the remaining excluded classes testable and cover them - #24
Merged
Merged
Conversation
Consumer now stops when its thread is interrupted instead of looping forever and swallowing the interruption, and ProducerConsumerExampleRunner waits for production and consumption to finish, then shuts the executor down so the pool threads no longer leak on every run. HyperlinkMouseListener gets a package-private LinkOpener seam with Desktop.browse as the default, so the click handler can be tested without a desktop. The error log now includes the exception instead of the mouse event. New tests cover ExamplesCommandLineRunner through a GenericApplicationContext with a fake runner bean and all logback level branches, Consumer, ProducerConsumerExampleRunner including thread cleanup, the click paths of HyperlinkMouseListener and ObservableAbstract.removeAllListeners. The corresponding JaCoCo excludes are removed; only the GUI shell remains excluded. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
Second PR of the coverage plan (phase 3). Only the GUI shell (
MainWindow,AppCommandLineRunner, the application class) remains excluded from JaCoCo.Bug fixes
Consumerlooped forever and swallowed interrupts. It now exits when its thread is interrupted.ProducerConsumerExampleRunnernever shut its executor down, leaking three threads per run. It now waits for the producer to finish and the queue to drain, then callsshutdownNowand awaits termination.HyperlinkMouseListener.mouseClickedlogged theMouseEventinstead of the exception on failure.Testability
HyperlinkMouseListenergains a package-privateLinkOpenerfunctional interface. The public constructor keepsDesktop.browseas the default.New tests
ExamplesCommandLineRunnerTests: disabled path, trace-enabled path, and the info-level hints, using aGenericApplicationContextwith a fake runner bean and a logbackListAppender. Covers all 10 branches.ConsumerTests: consumes then stops on interrupt; stops immediately if already interrupted.ProducerConsumerExampleRunnerTests: runs to completion within a timeout and leaves no extra pool threads alive.HyperlinkMouseListenerTests: click opens the entered link, malformed link and opener failure are logged not thrown, press and release are no-ops.ObserverTests:removeAllListenersclears every listener.Coverage
The seven missed instructions are the "consumers did not stop in time" warning and the real
Desktop.browsecall, neither of which can run in a headless test.Concurrency tests were run five extra times locally with no failures.
Next
Phase 4: raise the JaCoCo instruction minimum to 0.95 and add a 0.90 branch rule.
🤖 Generated with Claude Code