Skip to content

discussion about an incomplete test#439

Draft
commandini wants to merge 1 commit into
ASSERT-KTH:masterfrom
commandini:discussion-on-incomplete-test
Draft

discussion about an incomplete test#439
commandini wants to merge 1 commit into
ASSERT-KTH:masterfrom
commandini:discussion-on-incomplete-test

Conversation

@commandini

@commandini commandini commented Jun 7, 2025

Copy link
Copy Markdown
Contributor

@cesarsotovalero Can you check the comments on this PR, please? This PR shouldn't be merged, I've created it to start a discussion and figure out what's missing to make DependencyClassFileVisitorTest correct. (Or fix something in DependencyClassFileVisitor)

@commandini
commandini marked this pull request as draft June 7, 2025 22:13
@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2025

Copy link
Copy Markdown

+ " their work (Adding classes and dependencies as edges).")
void test_that_graph_is_collecting_edges_from_asm_correctly() throws IOException {

ResultCollector resultCollector = new ResultCollector();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

resultCollector object is isolated and useless, it's created in the test method but it's never used. visitor object has its own ResultCollector instance.

// Checking for the expected results.
Assertions.assertTrue(directedGraph.containsVertex(className));
for (String referencedClassMember : resultCollector.getDependencies()) {
for (String referencedClassMember : visitor.getDependencies()) {

@commandini commandini Jun 7, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cesarsotovalero By the description of the test method, it feels like we should check the dependencies of the visitor. Since resultCollector is isolated and useless, the for loop body is never executed. But there's another problem, even if we use visitor's dependencies in this loop, the loop body won't be entered because there's a call resultCollector.clearClasses(); at the end of DependencyClassFileVisitor#visitClass(). I couldn't figure out why resultCollector of visitior is immediately cleared after being used for visiting class members. That's why visitor.getDependencies() will be empty. I don't know how to proceed to make this test complete.

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.

1 participant