Package com.puppycrawl.tools.checkstyle

Examples of com.puppycrawl.tools.checkstyle.DefaultConfiguration.addAttribute()


    public void testIgnoreAccess()
        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(VisibilityModifierCheck.class);
        checkConfig.addAttribute("publicMemberPattern", "^r[A-Z]");
        checkConfig.addAttribute("protectedAllowed", "true");
        checkConfig.addAttribute("packageAllowed", "true");
        final String[] expected = {
            "17:20: Variable 'fData' must be private and have accessor methods.",
            "77:20: Variable 'someValue' must be private and have accessor methods.",
View Full Code Here


        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(VisibilityModifierCheck.class);
        checkConfig.addAttribute("publicMemberPattern", "^r[A-Z]");
        checkConfig.addAttribute("protectedAllowed", "true");
        checkConfig.addAttribute("packageAllowed", "true");
        final String[] expected = {
            "17:20: Variable 'fData' must be private and have accessor methods.",
            "77:20: Variable 'someValue' must be private and have accessor methods.",
        };
View Full Code Here

    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(VisibilityModifierCheck.class);
        checkConfig.addAttribute("publicMemberPattern", "^r[A-Z]");
        checkConfig.addAttribute("protectedAllowed", "true");
        checkConfig.addAttribute("packageAllowed", "true");
        final String[] expected = {
            "17:20: Variable 'fData' must be private and have accessor methods.",
            "77:20: Variable 'someValue' must be private and have accessor methods.",
        };
        verify(checkConfig, getPath("InputInner.java"), expected);
View Full Code Here

    public void testAllowMarker()
        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(InterfaceIsTypeCheck.class);
        checkConfig.addAttribute("allowMarkerInterfaces", "false");
        final String[] expected = {
            "20: interfaces should describe a type and hence have methods.",
            "25: interfaces should describe a type and hence have methods.",
        };
        verify(checkConfig, getPath("InputInterfaceIsType.java"), expected);
View Full Code Here

    public void testSpecified()
        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(StaticVariableNameCheck.class);
        checkConfig.addAttribute("format", "^s[A-Z][a-zA-Z0-9]*$");
        final String[] expected = {
            "30:24: Name 'badStatic' must match pattern '^s[A-Z][a-zA-Z0-9]*$'.",
        };
        verify(checkConfig, getPath("InputSimple.java"), expected);
    }
View Full Code Here

    public void testAccessTuning()
        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(StaticVariableNameCheck.class);
        checkConfig.addAttribute("format", "^s[A-Z][a-zA-Z0-9]*$");
        checkConfig.addAttribute("applyToPrivate", "false"); // allow method names and class names to equal
        final String[] expected = {
        };
        verify(checkConfig, getPath("InputSimple.java"), expected);
    }
View Full Code Here

        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(StaticVariableNameCheck.class);
        checkConfig.addAttribute("format", "^s[A-Z][a-zA-Z0-9]*$");
        checkConfig.addAttribute("applyToPrivate", "false"); // allow method names and class names to equal
        final String[] expected = {
        };
        verify(checkConfig, getPath("InputSimple.java"), expected);
    }
}
View Full Code Here

    @Test
    public void testIt() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(TodoCommentCheck.class);
        checkConfig.addAttribute("format", "FIXME:");
        final String[] expected = {
            "161: Comment matches to-do format 'FIXME:'.",
            "162: Comment matches to-do format 'FIXME:'.",
            "163: Comment matches to-do format 'FIXME:'.",
            "167: Comment matches to-do format 'FIXME:'.",
View Full Code Here

    @Test
    public void testGroups() throws Exception
    {
        final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class);
        checkConfig.addAttribute("groups", "java.awt");
        checkConfig.addAttribute("groups", "javax.swing");
        checkConfig.addAttribute("groups", "java.io");
        final String[] expected = {
            "5: Wrong order for 'java.awt.Dialog' import.",
            "13: Wrong order for 'java.io.IOException' import.",
View Full Code Here

    @Test
    public void testGroups() throws Exception
    {
        final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class);
        checkConfig.addAttribute("groups", "java.awt");
        checkConfig.addAttribute("groups", "javax.swing");
        checkConfig.addAttribute("groups", "java.io");
        final String[] expected = {
            "5: Wrong order for 'java.awt.Dialog' import.",
            "13: Wrong order for 'java.io.IOException' import.",
            "16: Wrong order for 'javax.swing.WindowConstants.*' import.",
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.