1
2
3
4
5 package com.qulice.errorprone;
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.params.ParameterizedTest;
14 import org.junit.jupiter.params.provider.ValueSource;
15
16
17
18
19
20
21
22
23
24
25 final class ErrorProneIgnoredTest {
26
27 @ParameterizedTest
28 @ValueSource(
29 strings = {
30 "src/test/resources/com/qulice/Bad.java",
31 "src/site/apt/Bad.java",
32 "src/it/violations/src/main/java/foo/Bad.java"
33 }
34 )
35 void ignoresJavaFilesInIgnoredDirectories(final String file) throws Exception {
36 final Environment env = new Environment.Mock().withFile(
37 file,
38 "class Bad { private int value; void set(int v) { this.value = this.value; } }"
39 );
40 MatcherAssert.assertThat(
41 String.format("%s must not be compiled", file),
42 new ErrorProneValidator(env).validate(
43 Collections.singletonList(new File(env.basedir(), file))
44 ),
45 Matchers.<Violation>empty()
46 );
47 }
48 }