Search in sources :

Example 71 with Configuration

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

the class NoFinalizerTest method noFinalizerBasicTest.

@Test
public void noFinalizerBasicTest() throws Exception {
    final String msg = getCheckMessage(NoFinalizerCheck.class, "avoid.finalizer.method");
    final String[] expected = { "5: " + msg };
    final Configuration checkConfig = getCheckConfig("NoFinalizer");
    final String filePath = getPath("InputNoFinalizer.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 72 with Configuration

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

the class SingleLineJavadocTest method singleLineJavadocTest.

@Test
public void singleLineJavadocTest() throws Exception {
    final String msg = getCheckMessage(SingleLineJavadocCheck.class, "singleline.javadoc");
    final String[] expected = { "5: " + msg, "13: " + msg, "29: " + msg, "32: " + msg, "35: " + msg, "38: " + msg, "41: " + msg };
    final Configuration checkConfig = getCheckConfig("SingleLineJavadoc");
    final String filePath = getPath("InputSingleLineJavadocCheck.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 73 with Configuration

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

the class JavadocParagraphTest method javadocParagraphCorrectTest.

@Test
public void javadocParagraphCorrectTest() throws Exception {
    final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
    final Configuration checkConfig = getCheckConfig("JavadocParagraph");
    final String filePath = getPath("InputCorrectJavadocParagraphCheck.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 74 with Configuration

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

the class NonEmptyAtclauseDescriptionTest method testDefaultConfiguration.

@Test
public void testDefaultConfiguration() throws Exception {
    final String msg = getCheckMessage(NonEmptyAtclauseDescriptionCheck.class, "non.empty.atclause");
    final String[] expected = { "34: " + msg, "35: " + msg, "36: " + msg, "37: " + msg, "38: " + msg, "39: " + msg, "48: " + msg, "49: " + msg, "50: " + msg, "51: " + msg, "52: " + msg };
    final Configuration checkConfig = getCheckConfig("NonEmptyAtclauseDescription");
    final String filePath = getPath("InputNonEmptyAtclauseDescriptionCheck.java");
    final Integer[] warnList = getLineNumbersFromExpected(expected);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) Test(org.junit.Test)

Example 75 with Configuration

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

the class SummaryJavadocTest method testCorrect.

@Test
public void testCorrect() throws Exception {
    final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
    final Configuration checkConfig = getCheckConfig("SummaryJavadoc");
    final String filePath = getPath("InputCorrectSummaryJavaDocCheck.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)137 Test (org.junit.Test)127 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)21 DefaultConfiguration (com.puppycrawl.tools.checkstyle.DefaultConfiguration)16 Properties (java.util.Properties)13 CheckstyleException (com.puppycrawl.tools.checkstyle.api.CheckstyleException)9 File (java.io.File)9 Checker (com.puppycrawl.tools.checkstyle.Checker)5 PropertiesExpander (com.puppycrawl.tools.checkstyle.PropertiesExpander)4 OneTopLevelClassCheck (com.puppycrawl.tools.checkstyle.checks.design.OneTopLevelClassCheck)3 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 ModuleFactory (com.puppycrawl.tools.checkstyle.ModuleFactory)2 AuditListener (com.puppycrawl.tools.checkstyle.api.AuditListener)2 RootModule (com.puppycrawl.tools.checkstyle.api.RootModule)2 AnnotationLocationCheck (com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck)2 EmptyLineSeparatorCheck (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)2 MethodParamPadCheck (com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2