Repository navigation
Expand file tree
/
Copy pathAnonymousClassOnFunctionalInterfaceCheckTest.java
More file actions
77 lines (69 loc) · 2.71 KB
/
Copy pathAnonymousClassOnFunctionalInterfaceCheckTest.java
File metadata and controls
77 lines (69 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* SonarQube Java
* Copyright (C) SonarSource Sàrl
* mailto:info AT sonarsource DOT com
*
* You can redistribute and/or modify this program under the terms of
* the Sonar Source-Available License Version 1, as published by SonarSource Sàrl.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Sonar Source-Available License for more details.
*
* You should have received a copy of the Sonar Source-Available License
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
package org.sonar.java.checks;
import java.io.File;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.sonar.java.checks.verifier.CheckVerifier;
import static org.sonar.java.checks.verifier.TestUtils.mainCodeSourcesPath;
import static org.sonar.java.checks.verifier.TestUtils.testCodeSourcesPath;
class AnonymousClassOnFunctionalInterfaceCheckTest {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(testCodeSourcesPath("checks/tests/AnonymousClassOnFunctionalInterfaceCheckSample.java"))
.withCheck(new AnonymousClassOnFunctionalInterfaceCheck())
.withJavaVersion(8)
.verifyIssues();
}
@Test
void test_without_semantic() {
CheckVerifier.newVerifier()
.onFile(testCodeSourcesPath("checks/tests/AnonymousClassOnFunctionalInterfaceCheckSampleWithoutSemantic.java"))
.withCheck(new AnonymousClassOnFunctionalInterfaceCheck())
.withJavaVersion(8)
.withoutSemantic()
.verifyIssues();
}
@Test
void test_gwt_supporting_lambdas() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPath("checks/AnonymousClassOnFunctionalInterfaceCheckGwtSample.java"))
.withCheck(new AnonymousClassOnFunctionalInterfaceCheck())
.withJavaVersion(8)
.withClassPath(List.of(new File("gwt-user-2.8.0.jar")))
.verifyIssues();
}
@Test
void test_gwt_not_supporting_lambdas() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPath("checks/AnonymousClassOnFunctionalInterfaceCheckGwtSample.java"))
.withCheck(new AnonymousClassOnFunctionalInterfaceCheck())
.withJavaVersion(8)
.withClassPath(List.of(new File("gwt-user-2.7.0.jar")))
.verifyNoIssues();
}
@Test
void test_gwt_dev_not_supporting_lambdas() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPath("checks/AnonymousClassOnFunctionalInterfaceCheckGwtSample.java"))
.withCheck(new AnonymousClassOnFunctionalInterfaceCheck())
.withJavaVersion(8)
.withClassPath(List.of(new File("gwt-user-2.8.0.jar"), new File("gwt-dev-2.6.1.jar")))
.verifyNoIssues();
}
}