Search in sources :

Example 61 with DefaultConfiguration

use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.

the class MutableExceptionCheckTest method testClassExtendsGenericClass.

@Test
public void testClassExtendsGenericClass() throws Exception {
    final DefaultConfiguration checkConfig = createCheckConfig(MutableExceptionCheck.class);
    final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
    verify(checkConfig, getPath("InputMutableExceptionClassExtendsGenericClass.java"), expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) Test(org.junit.Test)

Example 62 with DefaultConfiguration

use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.

the class MutableExceptionCheckTest method testDefault.

@Test
public void testDefault() throws Exception {
    final DefaultConfiguration checkConfig = createCheckConfig(MutableExceptionCheck.class);
    final String[] expected = { "6:9: " + getCheckMessage(MSG_KEY, "errorCode"), "23:9: " + getCheckMessage(MSG_KEY, "errorCode"), "46:9: " + getCheckMessage(MSG_KEY, "errorCode") };
    verify(checkConfig, getPath("InputMutableException.java"), expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) Test(org.junit.Test)

Example 63 with DefaultConfiguration

use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.

the class ReturnCountCheckTest method testLambdasOnly.

@Test
public void testLambdasOnly() throws Exception {
    final DefaultConfiguration checkConfig = createCheckConfig(ReturnCountCheck.class);
    checkConfig.addAttribute("tokens", "LAMBDA");
    final String[] expected = { "34:42: " + getCheckMessage(MSG_KEY, 3, 2) };
    verify(checkConfig, getPath("InputReturnCountLambda.java"), expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) Test(org.junit.Test)

Example 64 with DefaultConfiguration

use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.

the class SimplifyBooleanExpressionCheckTest method testIt.

@Test
public void testIt() throws Exception {
    final DefaultConfiguration checkConfig = createCheckConfig(SimplifyBooleanExpressionCheck.class);
    final String[] expected = { "20:18: " + getCheckMessage(MSG_KEY), "41:36: " + getCheckMessage(MSG_KEY), "42:36: " + getCheckMessage(MSG_KEY), "43:16: " + getCheckMessage(MSG_KEY), "43:32: " + getCheckMessage(MSG_KEY) };
    verify(checkConfig, getPath("InputSimplifyBoolean.java"), expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) Test(org.junit.Test)

Example 65 with DefaultConfiguration

use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.

the class UnnecessaryParenthesesCheckTest method test15Extensions.

@Test
public void test15Extensions() throws Exception {
    final DefaultConfiguration checkConfig = createCheckConfig(UnnecessaryParenthesesCheck.class);
    final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
    verify(checkConfig, getPath("Input15Extensions.java"), expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) Test(org.junit.Test)

Aggregations

DefaultConfiguration (com.puppycrawl.tools.checkstyle.DefaultConfiguration)1004 Test (org.junit.Test)986 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)47 CheckstyleException (com.puppycrawl.tools.checkstyle.api.CheckstyleException)31 File (java.io.File)22 Checker (com.puppycrawl.tools.checkstyle.Checker)16 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)13 BriefUtLogger (com.puppycrawl.tools.checkstyle.BriefUtLogger)10 Locale (java.util.Locale)5 Method (java.lang.reflect.Method)4 IllegalCatchCheck (com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck)3 IOException (java.io.IOException)3 BaseCheckTestSupport (com.puppycrawl.tools.checkstyle.BaseCheckTestSupport)2 Configuration (com.puppycrawl.tools.checkstyle.api.Configuration)2 LocalizedMessage (com.puppycrawl.tools.checkstyle.api.LocalizedMessage)2 FileContentsHolder (com.puppycrawl.tools.checkstyle.checks.FileContentsHolder)2 RandomAccessFile (java.io.RandomAccessFile)2 PropertiesExpander (com.puppycrawl.tools.checkstyle.PropertiesExpander)1 TokenTypes (com.puppycrawl.tools.checkstyle.api.TokenTypes)1 MSG_KEY (com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck.MSG_KEY)1