|
19 | 19 | */ |
20 | 20 | package org.sonar.java.checks; |
21 | 21 |
|
22 | | -import com.google.common.collect.ImmutableList; |
23 | | -import org.junit.Rule; |
24 | 22 | import org.junit.Test; |
25 | | -import org.sonar.java.ast.JavaAstScanner; |
26 | | -import org.sonar.java.model.VisitorsBridge; |
27 | | -import org.sonar.squidbridge.api.SourceFile; |
28 | | -import org.sonar.squidbridge.checks.CheckMessagesVerifierRule; |
29 | | - |
30 | | -import java.io.File; |
| 23 | +import org.sonar.java.checks.verifier.JavaCheckVerifier; |
31 | 24 |
|
32 | 25 | public class DeprecatedHashAlgorithmCheckTest { |
33 | 26 |
|
34 | | - @Rule |
35 | | - public CheckMessagesVerifierRule checkMessagesVerifier = new CheckMessagesVerifierRule(); |
36 | | - |
37 | 27 | @Test |
38 | 28 | public void test() { |
39 | | - SourceFile file = JavaAstScanner.scanSingleFile(new File("src/test/files/checks/DeprecatedHashAlgorithmCheck.java"), |
40 | | - new VisitorsBridge(new DeprecatedHashAlgorithmCheck(), ImmutableList.of(new File("target/test-classes")))); |
41 | | - checkMessagesVerifier.verify(file.getCheckMessages()) |
42 | | - .next().atLine(8).withMessage("Use a stronger encryption algorithm than MD5.") |
43 | | - .next().atLine(9).withMessage("Use a stronger encryption algorithm than SHA-1.") |
44 | | - .next().atLine(11).withMessage("Use a stronger encryption algorithm than MD5.") |
45 | | - .next().atLine(12).withMessage("Use a stronger encryption algorithm than SHA-1.") |
46 | | - .next().atLine(14).withMessage("Use a stronger encryption algorithm than MD5.") |
47 | | - .next().atLine(15).withMessage("Use a stronger encryption algorithm than SHA-1.") |
48 | | - .next().atLine(16).withMessage("Use a stronger encryption algorithm than SHA-1.") |
49 | | - .next().atLine(18).withMessage("Use a stronger encryption algorithm than MD5.") |
50 | | - .next().atLine(19).withMessage("Use a stronger encryption algorithm than MD5.") |
51 | | - .next().atLine(20).withMessage("Use a stronger encryption algorithm than SHA-1.") |
52 | | - .next().atLine(21).withMessage("Use a stronger encryption algorithm than SHA-1.") |
53 | | - .next().atLine(22).withMessage("Use a stronger encryption algorithm than SHA-1.") |
54 | | - .next().atLine(23).withMessage("Use a stronger encryption algorithm than SHA-1.") |
55 | | - .next().atLine(28).withMessage("Use a stronger encryption algorithm than MD5.") |
56 | | - .next().atLine(29).withMessage("Use a stronger encryption algorithm than MD5.") |
57 | | - .next().atLine(30).withMessage("Use a stronger encryption algorithm than SHA-1."); |
| 29 | + JavaCheckVerifier.verify("src/test/files/checks/DeprecatedHashAlgorithmCheck.java", new DeprecatedHashAlgorithmCheck()); |
58 | 30 | } |
59 | 31 |
|
60 | 32 | } |
0 commit comments