Skip to content

test: add comprehensive tests for GraphFileParser#93

Open
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
test/graph-file-parser
Open

test: add comprehensive tests for GraphFileParser#93
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
test/graph-file-parser

Conversation

@sauravbhattacharya001
Copy link
Owner

Summary

Adds 22 JUnit test cases for \GraphFileParser, which previously had zero test coverage despite being the core file I/O and parsing logic.

Test Coverage

Category Tests
Basic parsing nodes, edges, weights preserved
Edge classification all 5 EdgeType codes correctly classified
Weight validation NaN, Infinity, invalid strings all skipped
Malformed input short edge lines, blank lines, empty files
Section handling case-insensitive headers, nodes-only files
Filter predicate include/exclude types from graph vs classification
Edge labels first edge of each type gets display label
Unknown types unrecognized codes still added to graph
Boundary values zero weight, negative weight
Error handling IOException on missing file

Why This Matters

\GraphFileParser.parse()\ is used by every analysis pipeline and the main UI. A parsing regression (e.g. silently dropping edges or misclassifying types) would propagate to all downstream analysis results.

22 test cases covering:
- Basic node/edge parsing and edge type classification
- Edge weight preservation and validation (NaN, Infinity, invalid)
- Malformed edge lines gracefully skipped with count
- Empty files and nodes-only files
- Blank line and whitespace tolerance
- Case-insensitive section headers
- Filter predicate (include/exclude edge types from graph)
- Unknown edge type codes handled correctly
- First-edge-of-type label assignment for legends
- Zero and negative weights accepted
- I/O error propagation for missing files
- getEdges() returns empty list for unused types
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions bot added tests Test additions or fixes size/l labels Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l tests Test additions or fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant