use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class CustomImportOrderTest method customImportTest1.
@Test
public void customImportTest1() throws Exception {
final String[] expected = { "4: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), "6: " + getCheckMessage(clazz, MSG_LINE_SEPARATOR, "java.awt.Button"), "8: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Dialog", "java.awt.Frame"), "12: " + getCheckMessage(clazz, MSG_LEX, "java.io.File", "javax.swing.JTable"), "13: " + getCheckMessage(clazz, MSG_LEX, "java.io.IOException", "javax.swing.JTable"), "14: " + getCheckMessage(clazz, MSG_LEX, "java.io.InputStream", "javax.swing.JTable"), "15: " + getCheckMessage(clazz, MSG_LEX, "java.io.Reader", "javax.swing.JTable"), "17: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.base.Ascii", "javax.swing.JTable") };
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
final String filePath = getPath("InputCustomImportOrder1.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class CustomImportOrderTest method validGoogleStyleOrderOfImportsTest.
@Test
public void validGoogleStyleOrderOfImportsTest() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
final String filePath = getPath("InputCustomImportOrderNoImports.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class CustomImportOrderTest method validTest.
@Test
public void validTest() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
final String filePath = getPath("InputCustomImportOrderValid.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class CustomImportOrderTest method customImportTest2.
@Test
public void customImportTest2() throws Exception {
final String[] expected = { "4: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), "9: " + getCheckMessage(clazz, MSG_LEX, "java.util.*", "java.util.StringTokenizer"), "11: " + getCheckMessage(clazz, MSG_LEX, "java.util.concurrent.*", "java.util.concurrent.AbstractExecutorService"), "13: " + getCheckMessage(clazz, MSG_LEX, "com.google.checkstyle.test.chapter2filebasic.rule21filename.*", "java.util.concurrent.AbstractExecutorService"), "14: " + getCheckMessage(clazz, MSG_LEX, "com.sun.xml.internal.xsom.impl.scd.Iterators", "java.util.concurrent.AbstractExecutorService"), "16: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.reflect.*", "java.util.concurrent.AbstractExecutorService") };
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
final String filePath = getPath("InputCustomImportOrder2.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class OneTopLevelClassTest method bad2Test.
@Test
public void bad2Test() throws Exception {
final Class<OneTopLevelClassCheck> clazz = OneTopLevelClassCheck.class;
final String messageKey = "one.top.level.class";
final String[] expected = { "5: " + getCheckMessage(clazz, messageKey, "FooIn"), "7: " + getCheckMessage(clazz, messageKey, "FooClass") };
final Configuration checkConfig = getCheckConfig("OneTopLevelClass");
final String filePath = getPath("InputOneTopLevelClassBad2.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
Aggregations