Skip to content

Testing: No test coverage for UI classes (CLI, Swing, AWT, Terminal) #38

@sfloess

Description

@sfloess

Description

None of the UI classes have any test coverage. While UI testing is complex, at least the CLI command logic and input validation could be tested.

Missing Tests

No tests for:

  • JNexus.java (CLI with 3 commands: list, delete, stats)
  • JNexusSwing.java (1446 lines, no tests)
  • JNexusAWT.java (no tests)
  • JNexusUI.java (Terminal UI, no tests)

Current Coverage

✓ Core business logic (NexusService, NexusClient) - well tested
✓ Data models (ComponentMetadata, SearchCriteria, etc.) - tested
✗ UI layer - 0% coverage

Testable Components

CLI (JNexus.java):

  • Command parsing and validation
  • Error handling for invalid inputs
  • Output formatting
  • Date parsing logic (currently generic catch blocks)

Swing/AWT/Terminal:

  • Input validation
  • Button/action handlers (can mock service calls)
  • Error display logic

Recommended Approach

For CLI:

@Test
void testListCommand_withInvalidDate_showsHelpfulError() {
    String[] args = {"list", "repo", "--created-after", "invalid"};
    int exitCode = new CommandLine(new JNexus()).execute(args);
    assertEquals(1, exitCode);
    // Verify error message mentions ISO 8601 format
}

For Swing/AWT:

  • Use headless mode: System.setProperty("java.awt.headless", "true")
  • Mock NexusService to test logic without real HTTP
  • Test error dialogs, input validation

Impact

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions