|
32 | 32 | import com.google.common.base.Joiner;
|
33 | 33 | import com.qulice.spi.Environment;
|
34 | 34 | import com.qulice.spi.ValidationException;
|
| 35 | +import org.junit.jupiter.api.Assertions; |
35 | 36 | import org.junit.jupiter.api.Disabled;
|
36 | 37 | import org.junit.jupiter.api.Test;
|
37 | 38 |
|
@@ -59,24 +60,28 @@ public void passesCorrectFilesWithNoExceptions() throws Exception {
|
59 | 60 | * @throws Exception If something wrong happens inside
|
60 | 61 | */
|
61 | 62 | @Disabled
|
62 |
| - @org.junit.Test(expected = ValidationException.class) |
| 63 | + @Test |
63 | 64 | public void reportsIncorrectlyAddedThrows() throws Exception {
|
64 |
| - final byte[] bytecode = new BytecodeMocker() |
65 |
| - .withSource( |
66 |
| - Joiner.on("\n").join( |
67 |
| - "package test;", |
68 |
| - "final class Main {", |
69 |
| - "public void foo() throws InterruptedException {", |
70 |
| - "System.out.println(\"test\");", |
71 |
| - "}", |
72 |
| - "}" |
73 |
| - ) |
74 |
| - ) |
75 |
| - .mock(); |
76 |
| - final Environment env = new Environment.Mock() |
77 |
| - .withFile("target/classes/Main.class", bytecode) |
78 |
| - .withDefaultClasspath(); |
79 |
| - new FindBugsValidator().validate(env); |
| 65 | + Assertions.assertThrows( |
| 66 | + ValidationException.class, |
| 67 | + () -> { |
| 68 | + final byte[] bytecode = new BytecodeMocker() |
| 69 | + .withSource( |
| 70 | + Joiner.on("\n").join( |
| 71 | + "package test;", |
| 72 | + "final class Main {", |
| 73 | + "public void foo() throws InterruptedException {", |
| 74 | + "System.out.println(\"test\");", |
| 75 | + "}", |
| 76 | + "}" |
| 77 | + ) |
| 78 | + ).mock(); |
| 79 | + final Environment env = new Environment.Mock() |
| 80 | + .withFile("target/classes/Main.class", bytecode) |
| 81 | + .withDefaultClasspath(); |
| 82 | + new FindBugsValidator().validate(env); |
| 83 | + } |
| 84 | + ); |
80 | 85 | }
|
81 | 86 |
|
82 | 87 | /**
|
@@ -107,15 +112,21 @@ public void ignoresCorrectlyAddedThrows() throws Exception {
|
107 | 112 | * FindbugsValidator throw exception for invalid file.
|
108 | 113 | * @throws Exception If something wrong happens inside
|
109 | 114 | */
|
110 |
| - @org.junit.Test(expected = ValidationException.class) |
| 115 | + @Test |
111 | 116 | public void throwsExceptionOnViolation() throws Exception {
|
112 |
| - final byte[] bytecode = new BytecodeMocker() |
113 |
| - .withSource("class Foo { public Foo clone() { return this; } }") |
114 |
| - .mock(); |
115 |
| - final Environment env = new Environment.Mock() |
116 |
| - .withFile("target/classes/Foo.class", bytecode) |
117 |
| - .withDefaultClasspath(); |
118 |
| - new FindBugsValidator().validate(env); |
| 117 | + Assertions.assertThrows( |
| 118 | + ValidationException.class, |
| 119 | + () -> { |
| 120 | + final byte[] bytecode = new BytecodeMocker() |
| 121 | + .withSource( |
| 122 | + "class Foo { public Foo clone() { return this; } }" |
| 123 | + ).mock(); |
| 124 | + final Environment env = new Environment.Mock() |
| 125 | + .withFile("target/classes/Foo.class", bytecode) |
| 126 | + .withDefaultClasspath(); |
| 127 | + new FindBugsValidator().validate(env); |
| 128 | + } |
| 129 | + ); |
119 | 130 | }
|
120 | 131 |
|
121 | 132 | /**
|
|
2 commit comments
0pdd commentedon Feb 8, 2019
Puzzle
939-39a57206
disappeared frompom.xml
, that's why I closed #1019. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.0pdd commentedon Feb 8, 2019
Puzzle
1019-4869c92c
discovered inqulice-maven-plugin/pom.xml
and submitted as #1030. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.