Package com.puppycrawl.tools.checkstyle

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


    @Test
    public void testExcludeScope() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(JavadocVariableCheck.class);
        checkConfig.addAttribute("scope", Scope.PRIVATE.getName());
        checkConfig.addAttribute("excludeScope", Scope.PROTECTED.getName());
        final String[] expected = {
            "7:5: Missing a Javadoc comment.",
            "8:5: Missing a Javadoc comment.",
            "18:9: Missing a Javadoc comment.",
View Full Code Here


    public void testExcludeScope() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(JavadocVariableCheck.class);
        checkConfig.addAttribute("scope", Scope.PRIVATE.getName());
        checkConfig.addAttribute("excludeScope", Scope.PROTECTED.getName());
        final String[] expected = {
            "7:5: Missing a Javadoc comment.",
            "8:5: Missing a Javadoc comment.",
            "18:9: Missing a Javadoc comment.",
            "19:9: Missing a Javadoc comment.",
View Full Code Here

    public void testIgnoredVariableNames()
        throws Exception
    {
        final DefaultConfiguration checkConfig =
                createCheckConfig(JavadocVariableCheck.class);
        checkConfig.addAttribute("ignoreNamePattern", "log|logger");
        final String[] expected = {
            "5:5: Missing a Javadoc comment.",
            "6:5: Missing a Javadoc comment.",
            "7:5: Missing a Javadoc comment.",
            "8:5: Missing a Javadoc comment.",
View Full Code Here

    public void testIncorrectCustom() throws Exception
    {
        final String tagOrder = "'[@author, @version, @param, @return, @throws, @exception, @see,"
                + " @since, @serial, @serialField, @serialData, @deprecated]'.";
        DefaultConfiguration checkConfig = createCheckConfig(AtclauseOrderCheck.class);
        checkConfig.addAttribute("target", "CLASS_DEF");

        final String[] expected = {
            "9: At-clauses have to appear in the order " + tagOrder,
            "11: At-clauses have to appear in the order " + tagOrder,
            "12: At-clauses have to appear in the order " + tagOrder,
View Full Code Here

   
    public void testException() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(UnusedParameterCheck.class);
        checkConfig.addAttribute("ignoreCatch", Boolean.FALSE.toString());
        final String[] expected = {
            "8:57: Unused parameter 'aUnreadPrimitive'.",
            "16:16: Unused parameter 'aUnreadObject'.",
            "25:26: Unused parameter 'unreadException'.",
            "29:66: Unused parameter 'aUnreadArray'.",           
View Full Code Here

   
    public void testIgnoreFormat() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(UnusedParameterCheck.class);
        checkConfig.addAttribute("ignoreFormat", "Array$");
        final String[] expected = {
            "8:57: Unused parameter 'aUnreadPrimitive'.",
            "16:16: Unused parameter 'aUnreadObject'.",
        };
        verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected);
View Full Code Here

    public void testIgnoreNonLocal() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(UnusedParameterCheck.class);
        checkConfig.addAttribute("ignoreNonLocal", "true");
        final String[] expected = {
            "8:57: Unused parameter 'aUnreadPrimitive'.",
            "29:66: Unused parameter 'aUnreadArray'.",           
        };
        verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected);
View Full Code Here

   
    public void testIgnoreFormat() throws Exception
        {
            final DefaultConfiguration checkConfig =
                createCheckConfig(UnusedPrivateFieldCheck.class);
            checkConfig.addAttribute("ignoreFormat", "Array$");
            final String[] expected = {
                "10:17: Unused private field 'mUnreadPrimitive'.",
                "20:17: Unused private field 'mUnused2'.",
                "22:30: Unused private field 'SUNUSED'.",
                "64:17: Unused private field 'mUnused'.",
View Full Code Here

    public void testAllowSerializationMethods() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(UnusedPrivateMethodCheck.class);
        checkConfig.addAttribute("allowSerializationMethods", "true");

        final String[] expected = {
            "7:18: Unused private method 'methodUnused0'.",
            "91:18: Unused private method 'writeObject'.",
            "95:18: Unused private method 'writeObject'.",
View Full Code Here

   
    public void testIgnoreFormat() throws Exception
        {
            final DefaultConfiguration checkConfig =
                createCheckConfig(OneMethodPrivateFieldCheck.class);
            checkConfig.addAttribute("ignoreFormat", "2$");
            final String[] expected = {
                "6:24: Field 'SFIELD0' is used in only one method.",
                "7:24: Field 'SFIELD1' is used in only one method.",
                "9:24: Field 'SFIELD3' is used in only one method.",
                "11:17: Field 'mField0' is used in only one method.",
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.