use of com.puppycrawl.tools.checkstyle.api.AbstractCheck in project checkstyle by checkstyle.
the class AllChecksTest method testRequiredTokensAreSubsetOfDefaultTokens.
@Test
public void testRequiredTokensAreSubsetOfDefaultTokens() throws Exception {
for (Class<?> check : CheckUtil.getCheckstyleChecks()) {
if (AbstractCheck.class.isAssignableFrom(check)) {
final AbstractCheck testedCheck = (AbstractCheck) check.getDeclaredConstructor().newInstance();
final int[] defaultTokens = testedCheck.getDefaultTokens();
final int[] requiredTokens = testedCheck.getRequiredTokens();
assertWithMessage("%s's required tokens must be a subset of default tokens.", check.getName()).that(isSubset(requiredTokens, defaultTokens)).isTrue();
}
}
}
use of com.puppycrawl.tools.checkstyle.api.AbstractCheck in project sevntu.checkstyle by sevntu-checkstyle.
the class AllChecksTest method testDefaultTokensAreSubsetOfAcceptableTokens.
@Test
public void testDefaultTokensAreSubsetOfAcceptableTokens() throws Exception {
for (Class<?> check : CheckUtil.getCheckstyleChecks()) {
if (AbstractCheck.class.isAssignableFrom(check)) {
final AbstractCheck testedCheck = (AbstractCheck) check.getDeclaredConstructor().newInstance();
final int[] defaultTokens = testedCheck.getDefaultTokens();
final int[] acceptableTokens = testedCheck.getAcceptableTokens();
if (!isSubset(defaultTokens, acceptableTokens)) {
final String errorMessage = String.format(Locale.ROOT, "%s's default tokens must be a subset" + " of acceptable tokens.", check.getName());
Assert.fail(errorMessage);
}
}
}
}
use of com.puppycrawl.tools.checkstyle.api.AbstractCheck in project sevntu.checkstyle by sevntu-checkstyle.
the class AllChecksTest method testRequiredTokensAreSubsetOfDefaultTokens.
@Test
public void testRequiredTokensAreSubsetOfDefaultTokens() throws Exception {
for (Class<?> check : CheckUtil.getCheckstyleChecks()) {
if (AbstractCheck.class.isAssignableFrom(check)) {
final AbstractCheck testedCheck = (AbstractCheck) check.getDeclaredConstructor().newInstance();
final int[] defaultTokens = testedCheck.getDefaultTokens();
final int[] requiredTokens = testedCheck.getRequiredTokens();
if (!isSubset(requiredTokens, defaultTokens)) {
final String errorMessage = String.format(Locale.ROOT, "%s's required tokens must be a subset" + " of default tokens.", check.getName());
Assert.fail(errorMessage);
}
}
}
}
Aggregations