chore: add comprehensive test coverage for camel-jbang-plugin-tui#24279
chore: add comprehensive test coverage for camel-jbang-plugin-tui#24279gnodet wants to merge 2 commits into
Conversation
Add 8 new test files with 161 test methods covering the TUI module's core utilities and parsers: ShellPanel (convertRow, encodeKeyEvent, convertAttrToStyle), FuzzyFilter, StatusParser, TuiHelper, LoadAvg, MonitorContext, SearchHighlighter, and CamelMonitor parseKey. Widen three methods in ShellPanel from private to package-private (convertRow, encodeKeyEvent, convertAttrToStyle) to enable direct unit testing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
All tested modules (2 modules)
|
Add 4 new test files with 59 test methods that render tab widgets into a virtual terminal buffer using TamboUI's Frame.forTesting(Buffer) and inspect the rendered cell content, styles, and colors. - HealthTabRenderTest (13 tests): health check table rendering, UP/DOWN status colors, filter toggle, header columns, footer hints - RoutesTabRenderTest (17 tests): route table rendering, Started/Stopped colors, failed count highlighting, top mode toggle, processors section - ErrorsTabRenderTest (15 tests): error table rendering, handled/unhandled colors, exchange ID display, exception name shortening, filter toggle - MonitorContextRenderTest (14 tests): renderNoSelection prompt, hint system, rightCell/centerCell alignment, sort label/style indicators Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
davsclaus
left a comment
There was a problem hiding this comment.
Good work adding comprehensive test coverage for the camel-jbang-plugin-tui module — 231 tests across 12 files covering unit tests, rendering tests, and key interaction tests is a solid foundation.
The visibility widening of three ShellPanel methods from private to package-private is a reasonable trade-off for testability, and since this is not a public API class, there's no API impact.
Minor observation: several render test classes reference HealthTabRenderTest.bufferToString() as a shared utility — if more tests are added later, extracting that into a dedicated test helper class would be cleaner.
CI is green, no rule violations found.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Summary
Claude Code on behalf of forgebot
Adds comprehensive test coverage for the
camel-jbang-plugin-tuimodule, which previously had zero tests.231 total tests across 12 test files covering:
Unit Tests (172 tests, 8 files)
MonitorContextTest— formatting helpers (formatSinceLast,formatLoad,formatMemory,formatBytes,buildBar), style logic (topTimeStyle,topDeltaStyle), string comparisonIntegrationInfoTest— integration info lookup (findSelected,findByPid), match logicHealthCheckInfoTest— health check comparisons, sorting, state validationRouteInfoTest— route info comparisons, sortingProcessorInfoTest— processor info comparisons, sorting, level indentationErrorInfoTest— error info comparisons, sorting, exception type shorteningEndpointInfoTest— endpoint info comparisons, sorting, direction logicShellPanelTest— JSON parsing helpers (removeJsonEscaping,toFlatJson), color assignment (getColor)Higher-Level Rendering Tests (59 tests, 4 files)
These tests render TUI tabs into a virtual terminal buffer using
Frame.forTesting(Buffer)and inspect the rendered output — verifying text content, colors, styles, and layout:HealthTabRenderTest(13 tests) — health check table rendering with UP (GREEN) / DOWN (RED) status colors, empty state placeholder, header columns, border title, readiness/liveness kind column, DOWN-only filter toggle, footer hints, sort cycleRoutesTabRenderTest(17 tests) — route table headers, route ID (CYAN) and FROM display, Started (GREEN) / Stopped (RED) colors, failed count RED highlighting, processors section, no-selection prompt, top mode toggle with timing headers, sort column in title, coverage/throughput displayErrorsTabRenderTest(15 tests) — error table headers, exchange ID display, short exception name (strips package prefix), route ID CYAN color, handled=true (GREEN) / handled=false (RED) colors, multiple errors, empty placeholder, error count in title, sort cycle, handled filter cycle, footer hintsMonitorContextRenderTest(14 tests) —renderNoSelectionprompt text and DIM style,hint()/hintLast()span generation with YELLOW BOLD keys,rightCellright-alignment,centerCellcentering,sortLabel▼/▲ indicators,sortStyleYELLOW+BOLD for active columnSource Changes
ShellPanel.java— 3 methods widened fromprivateto package-private (removeJsonEscaping,toFlatJson,getColor) to enable testingTest plan
mvn test -pl dsl/camel-jbang/camel-jbang-plugin-tui)Frame.forTesting(Buffer)to render tabs into virtual terminal buffers🤖 Generated with Claude Code