Search in sources :

Example 1 with Checks

use of org.mockito.internal.util.Checks in project checkstyle by checkstyle.

the class TreeWalkerTest method testBehaviourWithZeroChecks.

@Test
public void testBehaviourWithZeroChecks() throws Exception {
    final TreeWalker treeWalker = new TreeWalker();
    final PackageObjectFactory factory = new PackageObjectFactory(new HashSet<>(), Thread.currentThread().getContextClassLoader());
    treeWalker.setModuleFactory(factory);
    // create file that should throw exception
    final File file = new File(temporaryFolder, "file.java");
    final FileText fileText = new FileText(file, new ArrayList<>());
    treeWalker.processFiltered(file, fileText);
    final Collection<Checks> checks = TestUtil.getInternalState(treeWalker, "ordinaryChecks");
    assertWithMessage("No checks -> No parsing").that(checks).isEmpty();
}
Also used : Checks(org.mockito.internal.util.Checks) FileText(com.puppycrawl.tools.checkstyle.api.FileText) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 2 with Checks

use of org.mockito.internal.util.Checks in project checkstyle by checkstyle.

the class TreeWalkerTest method testProcessNonJavaFilesWithoutException.

@Test
public void testProcessNonJavaFilesWithoutException() throws Exception {
    final TreeWalker treeWalker = new TreeWalker();
    treeWalker.setTabWidth(1);
    treeWalker.configure(new DefaultConfiguration("default config"));
    final File file = new File(getPath("InputTreeWalkerNotJava.xml"));
    final FileText fileText = new FileText(file, StandardCharsets.ISO_8859_1.name());
    treeWalker.processFiltered(file, fileText);
    final Collection<Checks> checks = TestUtil.getInternalState(treeWalker, "ordinaryChecks");
    assertWithMessage("No checks -> No parsing").that(checks).isEmpty();
}
Also used : Checks(org.mockito.internal.util.Checks) FileText(com.puppycrawl.tools.checkstyle.api.FileText) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

FileText (com.puppycrawl.tools.checkstyle.api.FileText)2 File (java.io.File)2 Test (org.junit.jupiter.api.Test)2 Checks (org.mockito.internal.util.Checks)2