use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class OneTopLevelClassCheckTest method testPackageInfoWithNoTypesDeclared.
@Test
public void testPackageInfoWithNoTypesDeclared() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(OneTopLevelClassCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getNonCompilablePath("package-info.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class ThrowsCountCheckTest method testNotIgnorePrivateMethod.
@Test
public void testNotIgnorePrivateMethod() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ThrowsCountCheck.class);
checkConfig.addAttribute("ignorePrivateMethods", "false");
final String[] expected = { "17:20: " + getCheckMessage(MSG_KEY, 5, 4), "22:20: " + getCheckMessage(MSG_KEY, 5, 4), "27:20: " + getCheckMessage(MSG_KEY, 6, 4), "35:28: " + getCheckMessage(MSG_KEY, 5, 4), "55:43: " + getCheckMessage(MSG_KEY, 5, 4) };
verify(checkConfig, getPath("InputThrowsCount.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class ThrowsCountCheckTest method testDefault.
@Test
public void testDefault() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ThrowsCountCheck.class);
final String[] expected = { "17:20: " + getCheckMessage(MSG_KEY, 5, 4), "22:20: " + getCheckMessage(MSG_KEY, 5, 4), "27:20: " + getCheckMessage(MSG_KEY, 6, 4), "55:43: " + getCheckMessage(MSG_KEY, 5, 4) };
verify(checkConfig, getPath("InputThrowsCount.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class VisibilityModifierCheckTest method testAllowPublicFinalFieldsInNonFinalClass.
@Test
public void testAllowPublicFinalFieldsInNonFinalClass() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(VisibilityModifierCheck.class);
checkConfig.addAttribute("allowPublicFinalFields", "true");
final String[] expected = { "34:20: " + getCheckMessage(MSG_KEY, "value"), "36:24: " + getCheckMessage(MSG_KEY, "bValue"), "37:31: " + getCheckMessage(MSG_KEY, "longValue") };
verify(checkConfig, getPath("InputImmutable.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class VisibilityModifierCheckTest method testVisibilityModifiersOfGenericFields.
@Test
public void testVisibilityModifiersOfGenericFields() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(VisibilityModifierCheck.class);
checkConfig.addAttribute("allowPublicImmutableFields", "true");
checkConfig.addAttribute("immutableClassCanonicalNames", "com.google.common.collect.ImmutableMap," + "java.lang.String," + "java.util.Optional," + "java.math.BigDecimal");
final String[] expected = { "16:56: " + getCheckMessage(MSG_KEY, "perfSeries"), "17:66: " + getCheckMessage(MSG_KEY, "peopleMap"), "18:66: " + getCheckMessage(MSG_KEY, "someMap"), "19:76: " + getCheckMessage(MSG_KEY, "newMap"), "21:45: " + getCheckMessage(MSG_KEY, "optionalOfObject"), "22:35: " + getCheckMessage(MSG_KEY, "obj"), "24:19: " + getCheckMessage(MSG_KEY, "rqUID"), "25:29: " + getCheckMessage(MSG_KEY, "rqTime"), "26:45: " + getCheckMessage(MSG_KEY, "rates"), "27:50: " + getCheckMessage(MSG_KEY, "loans"), "28:60: " + getCheckMessage(MSG_KEY, "cards"), "29:60: " + getCheckMessage(MSG_KEY, "values"), "30:70: " + getCheckMessage(MSG_KEY, "permissions"), "32:38: " + getCheckMessage(MSG_KEY, "mapOfStrings"), "33:48: " + getCheckMessage(MSG_KEY, "names"), "34:48: " + getCheckMessage(MSG_KEY, "links"), "35:38: " + getCheckMessage(MSG_KEY, "presentations"), "36:48: " + getCheckMessage(MSG_KEY, "collection"), "39:73: " + getCheckMessage(MSG_KEY, "exceptions") };
verify(checkConfig, getPath("InputVisibilityModifierGenerics.java"), expected);
}
Aggregations