Search in sources :

Example 41 with Configuration

use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.

the class RightCurlyTest method rightCurlyTestAlone.

@Test
public void rightCurlyTestAlone() throws Exception {
    final String[] expected = { "20:17: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 17), "32:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13), "79:27: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_BREAK_BEFORE, "}", 27) };
    final Configuration checkConfig = getCheckConfig("RightCurly", "RightCurlySame");
    final String filePath = getPath("InputRightCurlyOther.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) Test(org.junit.Test)

Example 42 with Configuration

use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.

the class JavadocMethodTest method javadocMethodTest.

@Test
public void javadocMethodTest() throws Exception {
    final String msg = getCheckMessage(JavadocMethodCheck.class, "javadoc.missing");
    final String[] expected = { "57:5: " + msg };
    final Configuration checkConfig = getCheckConfig("JavadocMethod");
    final String filePath = getPath("InputJavadocMethodCheck.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) Test(org.junit.Test)

Example 43 with Configuration

use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.

the class IndentationTest method correctTest.

@Test
public void correctTest() throws Exception {
    final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
    final Configuration checkConfig = getCheckConfig("Indentation");
    final String filePath = getPath("InputIndentationCorrect.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) Test(org.junit.Test)

Example 44 with Configuration

use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.

the class IndentationTest method correctClassTest.

@Test
public void correctClassTest() throws Exception {
    final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
    final Configuration checkConfig = getCheckConfig("Indentation");
    final String filePath = getPath("InputIndentationCorrectClass.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) Test(org.junit.Test)

Example 45 with Configuration

use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.

the class IndentationTest method correctForTest.

@Test
public void correctForTest() throws Exception {
    final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
    final Configuration checkConfig = getCheckConfig("Indentation");
    final String filePath = getPath("InputIndentationCorrectForAndParameter.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) Test(org.junit.Test)

Aggregations

Configuration (com.puppycrawl.tools.checkstyle.api.Configuration)307 Test (org.junit.jupiter.api.Test)179 Test (org.junit.Test)100 DefaultConfiguration (com.puppycrawl.tools.checkstyle.DefaultConfiguration)34 Properties (java.util.Properties)21 CheckstyleException (com.puppycrawl.tools.checkstyle.api.CheckstyleException)16 File (java.io.File)13 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 PropertiesExpander (com.puppycrawl.tools.checkstyle.PropertiesExpander)11 Checker (com.puppycrawl.tools.checkstyle.Checker)9 HashSet (java.util.HashSet)8 InputSource (org.xml.sax.InputSource)7 OneTopLevelClassCheck (com.puppycrawl.tools.checkstyle.checks.design.OneTopLevelClassCheck)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 ConfigurationLoader (com.puppycrawl.tools.checkstyle.ConfigurationLoader)5 URI (java.net.URI)5 MethodParamPadCheck (com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck)4 Set (java.util.Set)4 ModuleFactory (com.puppycrawl.tools.checkstyle.ModuleFactory)3