1
2
3
4
5 package com.qulice.checkstyle;
6
7 import com.qulice.spi.Environment;
8 import com.qulice.spi.Violation;
9 import java.io.File;
10 import java.util.Collections;
11 import org.hamcrest.MatcherAssert;
12 import org.hamcrest.Matchers;
13 import org.junit.jupiter.api.Test;
14
15
16
17
18
19
20
21
22
23
24
25
26 final class CheckstyleValidatorExcludesTest {
27
28 @Test
29 void skipsProcessingWhenAllFilesExcluded() throws Exception {
30 final String file = "src/main/java/foo/Main.java";
31 final Environment env = new ExcludingEnvironment(
32 new Environment.Mock().withFile(file, "class Main { }")
33 );
34 MatcherAssert.assertThat(
35 "Excluded files must not yield violations",
36 new CheckstyleValidator(env).validate(
37 Collections.singletonList(new File(env.basedir(), file))
38 ),
39 Matchers.<Violation>empty()
40 );
41 }
42 }