Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: test for the agent added #17

Merged
merged 14 commits into from
Nov 29, 2024
Merged

test: test for the agent added #17

merged 14 commits into from
Nov 29, 2024

Conversation

serenacofano
Copy link
Contributor

This test include:

  • test on the correctness of the output dependencies list and tree
  • test on the capability of the tool to handle empty SBOM
  • test on the capability of the tool to handle classes without annotation
  • test on the capability of the tool to correctly read the annotations

@serenacofano serenacofano linked an issue Nov 25, 2024 that may be closed by this pull request
Copy link
Member

@algomaster99 algomaster99 left a comment

Choose a reason for hiding this comment

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

Left some comments. Major problem is that getSBOM is not tested properly.

}

private boolean isAdditionalMethodPresent(ClassReader classReader) {
final boolean[] methodPresent = {false};
Copy link
Member

Choose a reason for hiding this comment

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

why is this a boolean[]? I think it can be be simply boolean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used the array because it is in an inner class and it requires a final variable. But If the variable is final I cannot change its value from false to true. Using the array I can declare it final and also modify it. But if you think it is better not to use an array, I can declare a boolean as a class-level field.

Copy link
Member

Choose a reason for hiding this comment

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

I can declare a boolean as a class-level field.

That would be a good coding practice. To declare it as a private field.


private boolean isAdditionalMethodInvoked(ClassReader classReader) {
final boolean[] methodInvoked = {false};
classReader.accept(new ClassVisitor(Opcodes.ASM9) {
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@algomaster99 algomaster99 merged commit 36628a3 into main Nov 29, 2024
2 checks passed
@algomaster99 algomaster99 deleted the test-agent branch November 29, 2024 10:15
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.

test: write tests for the Agent
2 participants