Issue #13321: Kill mutation for DescendantTokenCheck#13375
Issue #13321: Kill mutation for DescendantTokenCheck#13375romani merged 1 commit intocheckstyle:masterfrom
Conversation
|
@Kevin222004 please generate reports and fix CI failures |
|
Github, generate report |
|
Report generation failed on phase "make_report", |
|
@Kevin222004 , please continue. |
|
conflict with spotbugs: |
|
we set we need to suppress spotbugs violations. with comment |
|
@Kevin222004 , please do excludes for spotbugs at https://github.com/checkstyle/checkstyle/blob/master/config/spotbugs-exclude.xml |
|
@Kevin222004 , please fix Checker |
|
@romani I will fix the checker but i dont know how can i fix https://dev.azure.com/romanivanovjr/romanivanovjr/_build/results?buildId=15736&view=logs&j=c902ebb4-c9f8-5f09-4e17-ff78fbbc842e&t=9ca98c81-ff64-58f0-9d03-a23ac1c4a111&l=1123 |
|
Add to suppression it for now |
|
@Kevin222004 , this looks like simple PR to update to get approval. |
| /** Specify set of tokens with limited occurrences as descendants. */ | ||
| @XdocsPropertyType(PropertyType.TOKEN_ARRAY) | ||
| private int[] limitedTokens = CommonUtil.EMPTY_INT_ARRAY; | ||
| private int[] limitedTokens; |
There was a problem hiding this comment.
@Kevin222004 Won't this throw NPE when there is no mention of this property in the config? limitedTokens is just not there in the config. In that case counts will be null and Arrays.fill(counts, 0); will throw an NPE.
There was a problem hiding this comment.
/*
DescendantToken
tokens = LITERAL_SWITCH
maximumDepth = 2
- limitedTokens =
minimumNumber = 1
*/In this type of config, an NPE would be thrown. Is limitedTokens mandatory for the user to set?
There was a problem hiding this comment.
Yes, should be npe.
It should be reproduced by default config usage.
@Kevin222004 , please look why it is not happening, we must have default config usage in tests.
It might be due to (default) usage in property-stle config in comment of Input.
There was a problem hiding this comment.
I am not sure where things have gone wrong from my side. but done
Test Added
97c05ef to
20ec60f
Compare
| @Test | ||
| public void testProperty() throws Exception { | ||
| final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; |
There was a problem hiding this comment.
testProperty is really vague, please keep a specific name.
There was a problem hiding this comment.
Input file has values that are not default,
There was a problem hiding this comment.
I have make it simple testLimitedToken
| // ok | ||
| public class InputDescendantTokenProperty { | ||
| } | ||
|
|
||
| class Test { | ||
| public static void main(String[] args) { | ||
| int x = 1; | ||
| switch (x) { // ok |
romani
left a comment
There was a problem hiding this comment.
Ok to merge as raised items are resolved
|
@romani Assigned it to you as 2 reviews are sufficient for PRs adding a test case to kill a mutation. |
Issue #13321: Kill mutation for DescendantTokenCheck
Check
https://checkstyle.org/checks/misc/descendanttoken.html#DescendantToken
mutation
checkstyle/config/pitest-suppressions/pitest-misc-suppressions.xml
Lines 3 to 19 in 20a52f7
Explaination
Test added
Regression
Diff Regression config: https://gist.githubusercontent.com/Kevin222004/14aa273cb63f5e0c9b09b80021c9662d/raw/e44a7eed1601ecce19ab969e66dd27c698281ebd/desc.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/21e3934e85f802e2fbd48af06d122364/raw/604256badd733d8568064f371d55657c04b00dfd/test-projects-2.properties
Report label: Regression-1