Skip to content

Expand test coverage: register orphaned test files and add tests for uncovered utility/checker classes#82

Merged
rostam merged 1 commit intomasterfrom
copilot/analyze-test-coverage
Mar 25, 2026
Merged

Expand test coverage: register orphaned test files and add tests for uncovered utility/checker classes#82
rostam merged 1 commit intomasterfrom
copilot/analyze-test-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

Several test files existed in test/ but were never compiled or run. Multiple core utility and graph-checker classes had zero test coverage.

Orphaned test files registered in build.xml

Five pre-existing test classes added to the Ant test target (66 tests recovered):

  • BiconnectedComponentsTest — 14 tests
  • G6FormatTest — 16 tests
  • GraphComplementTest — 11 tests
  • GraphJoinTest — 11 tests
  • RenderTableTest — 1 test

New: UtilityAndCheckerTest.java (33 tests)

Covers classes with no prior test coverage:

Class # Tests Key cases
AcyclicChecker 7 tree, cycle, forest, K4, triangle
BipartiteChecker 8 even/odd cycles, K2, K4, path, single vertex
ConnectivityChecker 8 empty graph (vacuous), disconnected components, path/cycle/K4
GOpUtils 7 center(), offsetPositionsToCenter(), midPoint()
Pair<F,S> 4 construction, nulls, mutability, generics

Net result: 337 → 403 tests; 18 → 24 registered test classes.

…UtilityAndCheckerTest

Co-authored-by: rostam <1497363+rostam@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rostam/GraphTea/sessions/ce73976f-09e9-4ea9-a5cf-23401e825b2a
@rostam rostam marked this pull request as ready for review March 25, 2026 17:04
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Expand test coverage: register orphaned tests and add utility/checker tests

🧪 Tests ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Register 5 orphaned test files in build.xml (66 tests recovered)
• Create UtilityAndCheckerTest.java with 33 new tests
• Expand test coverage for AcyclicChecker, BipartiteChecker, ConnectivityChecker
• Add tests for GOpUtils utility methods and Pair generic class
Diagram
flowchart LR
  A["Orphaned Test Files<br/>5 classes"] -->|"Register in build.xml"| B["Build Configuration<br/>Updated"]
  C["Uncovered Classes<br/>AcyclicChecker, BipartiteChecker<br/>ConnectivityChecker, GOpUtils, Pair"] -->|"Create UtilityAndCheckerTest.java"| D["33 New Tests<br/>Full Coverage"]
  B -->|"Result"| E["403 Total Tests<br/>24 Registered Classes"]
  D -->|"Result"| E
Loading

Grey Divider

File Changes

1. test/UtilityAndCheckerTest.java 🧪 Tests +358/-0

New comprehensive test suite for utility and checker classes

• New test class with 33 comprehensive tests for previously uncovered utility and checker classes
• AcyclicChecker: 7 tests covering trees, cycles, forests, complete graphs, and triangles
• BipartiteChecker: 8 tests for even/odd cycles, complete graphs, paths, and single vertices
• ConnectivityChecker: 8 tests including empty graph edge case, disconnected components, and various
 connected structures
• GOpUtils: 7 tests for center(), offsetPositionsToCenter(), and midPoint() methods
• Pair generic class: 4 tests for construction, null handling, mutability, and generic type support

test/UtilityAndCheckerTest.java


2. build.xml ⚙️ Configuration changes +12/-0

Register orphaned and new test files in build configuration

• Register 5 previously orphaned test files in javac compilation target: BiconnectedComponentsTest,
 G6FormatTest, GraphComplementTest, GraphJoinTest, RenderTableTest
• Register same 5 test files in junitlauncher test execution target
• Register new UtilityAndCheckerTest.java in both compilation and execution targets
• Enables 66 recovered tests plus 33 new tests to be compiled and executed

build.xml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 25, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (1) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. Multiple statements per line 📘 Rule violation ⚙ Maintainability
Description
New test code places multiple statements on the same line (e.g., variable declaration and method
call), violating the one-statement-per-line requirement and likely triggering Checkstyle formatting
failures.
Code

test/UtilityAndCheckerTest.java[R239-257]

+        Vertex v1 = new Vertex(); v1.setLocation(new GPoint(0.0, 0.0));
+        Vertex v2 = new Vertex(); v2.setLocation(new GPoint(4.0, 6.0));
+        g.insertVertex(v1); g.insertVertex(v2);
+
+        GPoint c = GOpUtils.center(g);
+        assertEquals(2.0, c.x, 1e-9);
+        assertEquals(3.0, c.y, 1e-9);
+    }
+
+    /** center() of a symmetric arrangement should lie at the origin. */
+    @Test
+    public void testGOpUtilsCenterSymmetricArrangement() {
+        GraphModel g = new GraphModel(false);
+        Vertex v1 = new Vertex(); v1.setLocation(new GPoint(-1.0, 0.0));
+        Vertex v2 = new Vertex(); v2.setLocation(new GPoint(1.0, 0.0));
+        Vertex v3 = new Vertex(); v3.setLocation(new GPoint(0.0, 2.0));
+        Vertex v4 = new Vertex(); v4.setLocation(new GPoint(0.0, -2.0));
+        g.insertVertex(v1); g.insertVertex(v2);
+        g.insertVertex(v3); g.insertVertex(v4);
Evidence
PR Compliance ID 6 forbids multiple statements on a single line. Lines like `Vertex v1 = new
Vertex(); v1.setLocation(...) and g.insertVertex(v1); g.insertVertex(v2);` contain two statements
separated by ; on the same line.

CLAUDE.md
test/UtilityAndCheckerTest.java[239-257]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`UtilityAndCheckerTest.java` contains multiple statements on single lines (e.g., `Vertex v1 = new Vertex(); v1.setLocation(...)` and `g.insertVertex(v1); g.insertVertex(v2);`), violating the one-statement-per-line requirement.

## Issue Context
This is enforced by the compliance checklist and typically by Checkstyle.

## Fix Focus Areas
- test/UtilityAndCheckerTest.java[239-257]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Non-UTF8 test compile 🐞 Bug ✓ Correctness
Description
The new test source contains non-ASCII characters, but the Ant test <javac> task does not specify an
encoding, so compilation can fail on non-UTF-8 platforms (e.g., Windows default cp1252). This will
break the ant test target in those environments.
Code

test/UtilityAndCheckerTest.java[R49-53]

+    /** A cycle graph C_n (n ≥ 3) contains a cycle, so it is not acyclic. */
+    @Test
+    public void testAcyclicCheckerCycleIsNotAcyclic() {
+        GraphModel g = CircleGenerator.generateCircle(4);
+        assertFalse(AcyclicChecker.isGraphAcyclic(g));
Evidence
UtilityAndCheckerTest.java includes a non-ASCII character '≥' in a comment, and build.xml’s test
compilation uses <javac ...> without encoding="UTF-8", meaning javac falls back to the platform
default charset, which is not guaranteed to support that character. This is a hard compilation
failure when the default encoding cannot represent the character.

test/UtilityAndCheckerTest.java[49-53]
build.xml[48-58]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`ant test` compiles test sources with platform-default encoding. Newly added test sources contain non-ASCII characters (e.g., `≥`), which can cause javac to fail on non-UTF-8 systems.

### Issue Context
Ant `<javac>` defaults to the platform charset unless `encoding` is set.

### Fix Focus Areas
- build.xml[48-83]
 - Add `encoding="UTF-8"` to the test `<javac>` task (and optionally also to the main compile `<javac>` for consistency).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Duplicated test include lists 🐞 Bug ⚙ Maintainability
Description
The test target requires adding each test twice (once to <javac> includes and again to the JUnit
<fileset> includes), so a future change can easily compile a test but not execute it. This can
silently reduce coverage by leaving tests orphaned again.
Code

build.xml[R77-82]

+            <include name="BiconnectedComponentsTest.java"/>
+            <include name="G6FormatTest.java"/>
+            <include name="GraphComplementTest.java"/>
+            <include name="GraphJoinTest.java"/>
+            <include name="RenderTableTest.java"/>
+            <include name="UtilityAndCheckerTest.java"/>
Evidence
In build.xml, test selection is duplicated: a list of *.java includes for compilation and a
separate list of *.class includes for execution. The PR had to add the same new tests in both
places, demonstrating the synchronization hazard (compile-only without run is an easy mistake).

build.xml[48-83]
build.xml[96-125]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Tests are selected via two separate hardcoded include lists (source compilation + class execution). This duplication can cause tests to compile but not run if one list is updated without the other.

### Issue Context
The PR added the same set of tests twice, confirming this is already a maintenance footgun.

### Fix Focus Areas
- build.xml[48-83]
- build.xml[96-125]

### Suggested approaches
- Use a shared Ant property/path pattern for both lists (e.g., include all `*Test.java` for compilation and `*Test.class` for execution), or
- Generate the `<fileset>` from the compiled output directory with a wildcard like `**/*Test.class` (if acceptable for your project), or
- Define the test names once (property) and reference it in both places.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

4. No-assert test noise 🐞 Bug ⚙ Maintainability
Description
RenderTableTest prints to stdout and contains no assertions, so it adds noise without validating
behavior and will always pass as long as no exception occurs. Now that it is registered, it can
clutter test logs and provides misleading “green” signal.
Code

build.xml[81]

+            <include name="RenderTableTest.java"/>
Evidence
RenderTableTest’s only action is printing a title to stdout, and it does not assert any expected
state/value. With the PR registering it into the test run, this behavior will now occur on every
ant test run.

test/RenderTableTest.java[7-15]
build.xml[119-121]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`RenderTableTest` currently has no assertions and prints to stdout.

### Issue Context
Now that the test is executed by the build, it should validate behavior and avoid noisy output.

### Fix Focus Areas
- test/RenderTableTest.java[7-15]
 - Replace `System.out.println(...)` with assertions such as `assertEquals("Test1", ret.getTitles().get(0))`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@rostam rostam merged commit 9a736be into master Mar 25, 2026
2 of 3 checks passed
Comment on lines +239 to +257
Vertex v1 = new Vertex(); v1.setLocation(new GPoint(0.0, 0.0));
Vertex v2 = new Vertex(); v2.setLocation(new GPoint(4.0, 6.0));
g.insertVertex(v1); g.insertVertex(v2);

GPoint c = GOpUtils.center(g);
assertEquals(2.0, c.x, 1e-9);
assertEquals(3.0, c.y, 1e-9);
}

/** center() of a symmetric arrangement should lie at the origin. */
@Test
public void testGOpUtilsCenterSymmetricArrangement() {
GraphModel g = new GraphModel(false);
Vertex v1 = new Vertex(); v1.setLocation(new GPoint(-1.0, 0.0));
Vertex v2 = new Vertex(); v2.setLocation(new GPoint(1.0, 0.0));
Vertex v3 = new Vertex(); v3.setLocation(new GPoint(0.0, 2.0));
Vertex v4 = new Vertex(); v4.setLocation(new GPoint(0.0, -2.0));
g.insertVertex(v1); g.insertVertex(v2);
g.insertVertex(v3); g.insertVertex(v4);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Multiple statements per line 📘 Rule violation ⚙ Maintainability

New test code places multiple statements on the same line (e.g., variable declaration and method
call), violating the one-statement-per-line requirement and likely triggering Checkstyle formatting
failures.
Agent Prompt
## Issue description
`UtilityAndCheckerTest.java` contains multiple statements on single lines (e.g., `Vertex v1 = new Vertex(); v1.setLocation(...)` and `g.insertVertex(v1); g.insertVertex(v2);`), violating the one-statement-per-line requirement.

## Issue Context
This is enforced by the compliance checklist and typically by Checkstyle.

## Fix Focus Areas
- test/UtilityAndCheckerTest.java[239-257]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +49 to +53
/** A cycle graph C_n (n ≥ 3) contains a cycle, so it is not acyclic. */
@Test
public void testAcyclicCheckerCycleIsNotAcyclic() {
GraphModel g = CircleGenerator.generateCircle(4);
assertFalse(AcyclicChecker.isGraphAcyclic(g));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Non-utf8 test compile 🐞 Bug ✓ Correctness

The new test source contains non-ASCII characters, but the Ant test <javac> task does not specify an
encoding, so compilation can fail on non-UTF-8 platforms (e.g., Windows default cp1252). This will
break the ant test target in those environments.
Agent Prompt
### Issue description
`ant test` compiles test sources with platform-default encoding. Newly added test sources contain non-ASCII characters (e.g., `≥`), which can cause javac to fail on non-UTF-8 systems.

### Issue Context
Ant `<javac>` defaults to the platform charset unless `encoding` is set.

### Fix Focus Areas
- build.xml[48-83]
  - Add `encoding="UTF-8"` to the test `<javac>` task (and optionally also to the main compile `<javac>` for consistency).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

2 participants