Package com.puppycrawl.tools.checkstyle

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


    @Test
    public void testCaseInsensitive() throws Exception
    {
        final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class);
        checkConfig.addAttribute("caseSensitive", "false");
        final String[] expected = {
        };

        verify(checkConfig, getPath("imports" + File.separator + "InputImportOrderCaseInsensitive.java"), expected);
    }
View Full Code Here


    public void testMethodFooName()
        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(MethodTypeParameterNameCheck.class);
        checkConfig.addAttribute("format", "^foo$");

        final String[] expected = {
            "7:13: Name 'TT' must match pattern '^foo$'.",
            "9:6: Name 'e_e' must match pattern '^foo$'.",
            "19:6: Name 'Tfo$o2T' must match pattern '^foo$'.",
View Full Code Here

    @Test
    public void testTop() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(ImportOrderCheck.class);
        checkConfig.addAttribute("option", "top");
        final String[] expected = {
            "4: Wrong order for 'java.awt.Button.ABORT' import.",
            "18: Wrong order for 'java.io.File.*' import.",
        };

View Full Code Here

    @Test
    public void testMax() throws Exception
    {
        DefaultConfiguration checkConfig = createCheckConfig(ThrowsCountCheck.class);
        checkConfig.addAttribute("max", "2");

        String[] expected = {
            "22:20: Throws count is 3 (max allowed is 2).",
        };
View Full Code Here

    public void testInterfaceFooName()
        throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(InterfaceTypeParameterNameCheck.class);
        checkConfig.addAttribute("format", "^foo$");

        final String[] expected = {
            "48:15: Name 'Input' must match pattern '^foo$'.",
            "52:24: Name 'T' must match pattern '^foo$'.",
        };
View Full Code Here

    @Test
    public void testIt() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(IllegalInstantiationCheck.class);
        checkConfig.addAttribute(
            "classes",
            "java.lang.Boolean,"
                + "com.puppycrawl.tools.checkstyle.InputModifier,"
                + "java.io.File,"
                + "java.awt.Color");
View Full Code Here

    @Test
    public void testAbove() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(ImportOrderCheck.class);
        checkConfig.addAttribute("option", "above");
        final String[] expected = {
            "5: Wrong order for 'java.awt.Button.ABORT' import.",
            "8: Wrong order for 'java.awt.Dialog' import.",
            "13: Wrong order for 'java.io.File' import.",
            "14: Wrong order for 'java.io.File.createTempFile' import.",
View Full Code Here

    @Test
    public void testInFlow() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(ImportOrderCheck.class);
        checkConfig.addAttribute("option", "inflow");
        final String[] expected = {
            "6: Wrong order for 'java.awt.Dialog' import.",
            "11: Wrong order for 'javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE' import.",
            "12: Wrong order for 'javax.swing.WindowConstants.*' import.",
            "13: Wrong order for 'javax.swing.JTable' import.",
View Full Code Here

    public void testUnder() throws Exception
    {
        // is default (testDefault)
        final DefaultConfiguration checkConfig =
            createCheckConfig(ImportOrderCheck.class);
        checkConfig.addAttribute("option", "under");
        final String[] expected = {
            "5: Wrong order for 'java.awt.Dialog' import.",
            "11: Wrong order for 'java.awt.Button.ABORT' import.",
            "14: Wrong order for 'java.io.File' import.",
        };
View Full Code Here

    @Test
    public void testNewlineAtEndOfFile() throws Exception
    {
        final DefaultConfiguration checkConfig =
            createCheckConfig(NewlineAtEndOfFileCheck.class);
        checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF.toString());
        final String[] expected = {};
        verify(
            createChecker(checkConfig),
            getPath("InputNewlineAtEndOfFile.java"),
            expected);
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.