Improved coverage for resolved declarations and fixed inconsistencies between them #3062
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all, sorry for the long PR but this includes a lot of tests.
I'll try to explain what is going on in each commit to make it easier to understand.
Commit Structure
1. Implement the base tests for each ResolvedDeclaration;
The base tests are interfaces that can be reused to validate common behavior .
2. Create tests for javaparsermodel declarations and javassistmodel;
This tests combine the previous tests with additional ones to validate the behavior of the class.
3. Implement AssociableToAST on in classes that missed it.
With this tests some classes did not implement the AssociableToAST as expected. The classes that required change were:
4. Improved code to match the expected behavior.
The issue was discussed at #3057 for different files, but same issue was seen here and fixed accordingly.
By default, some of the methods in ResolvedDeclaration have a default return value. An examples of this is the method
ResolvedDeclaration#isField()
. Some old classes instead of using the default behavior (returning false in the previous example) they throw an UnsupportedException.5. JavaParserParameterDeclaration cleanup
Removed unnecessary method definitions since they are already defined in the super class. This helps by improve the line coverage and keep the same behavior.
6. JavaParserPatternDeclaration cleanup
The same as last one but for a different file.