Issue #1290: Coverage has been increased to 100% in AbstractDeclarationCollector.

This commit is contained in:
Ilja Dubinin 2015-09-29 22:40:17 +01:00
parent d877cb15cf
commit ce4df1ec00
3 changed files with 33 additions and 5 deletions

View File

@ -1661,11 +1661,6 @@
<totalBranchRate>89</totalBranchRate>
<totalLineRate>95</totalLineRate>
<regexes>
<regex>
<pattern>.*.checks.AbstractDeclarationCollector</pattern>
<branchRate>94</branchRate>
<lineRate>100</lineRate>
</regex>
<regex>
<pattern>.*.checks.SuppressWarningsHolder</pattern>
<branchRate>86</branchRate>

View File

@ -105,4 +105,13 @@ public class RequireThisCheckTest extends BaseCheckTestSupport {
Assert.assertNotNull(check.getDefaultTokens());
Assert.assertNotNull(check.getRequiredTokens());
}
@Test
public void testWithAnnonymousClass() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(RequireThisCheck.class);
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
getPath("coding" + File.separator + "InputRequireThis3.java"),
expected);
}
}

View File

@ -0,0 +1,24 @@
package com.puppycrawl.tools.checkstyle.checks.coding;
public class InputRequireThis3 {
interface AnonWithEmpty {
public void fooEmpty();
}
void method() {
AnonWithEmpty foo = new AnonWithEmpty() {
public void emptyMethod() {
}
@Override
public void fooEmpty() {
int a = doSideEffect();
}
public int doSideEffect() {
return 1;
}
};
}
}