Skip to content

Commit d109435

Browse files
committedFeb 8, 2019
Merge branch '__rultor'
2 parents 660187d + 7a7a429 commit d109435

File tree

8 files changed

+50
-38
lines changed

8 files changed

+50
-38
lines changed
 

‎pom.xml

-5
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,6 @@
134134
<artifactId>commons-lang3</artifactId>
135135
<version>3.7</version>
136136
</dependency>
137-
<!--
138-
@todo #939:30min Upgrade to Junit5. Continue to upgrade to Junit5
139-
updating qulice-maven-plugin sub-module and removing remaining
140-
junit4 tags.
141-
-->
142137
<dependency>
143138
<groupId>org.junit.jupiter</groupId>
144139
<artifactId>junit-jupiter-api</artifactId>

‎qulice-checkstyle/src/test/resources/com/qulice/checkstyle/MissingJavadocTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
package foo;
55

6-
import org.junit.Test;
6+
import org.junit.jupiter.api.Test;
77

88
/**
99
* Simple.

‎qulice-findbugs/src/test/java/com/qulice/findbugs/FindBugsValidatorTest.java

+36-25
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.google.common.base.Joiner;
3333
import com.qulice.spi.Environment;
3434
import com.qulice.spi.ValidationException;
35+
import org.junit.jupiter.api.Assertions;
3536
import org.junit.jupiter.api.Disabled;
3637
import org.junit.jupiter.api.Test;
3738

@@ -59,24 +60,28 @@ public void passesCorrectFilesWithNoExceptions() throws Exception {
5960
* @throws Exception If something wrong happens inside
6061
*/
6162
@Disabled
62-
@org.junit.Test(expected = ValidationException.class)
63+
@Test
6364
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+
);
8085
}
8186

8287
/**
@@ -107,15 +112,21 @@ public void ignoresCorrectlyAddedThrows() throws Exception {
107112
* FindbugsValidator throw exception for invalid file.
108113
* @throws Exception If something wrong happens inside
109114
*/
110-
@org.junit.Test(expected = ValidationException.class)
115+
@Test
111116
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+
);
119130
}
120131

121132
/**

‎qulice-maven-plugin/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
<artifactId>qulice-maven-plugin</artifactId>
4343
<packaging>maven-plugin</packaging>
4444
<name>qulice-maven-plugin</name>
45+
<!--
46+
@todo #1019:30min Upgrade to Junit5. Finish JUnit upgrade to JUnit5 by
47+
upgrading it in qulice-maven-plugin submodules. Qulice-maven-plugin
48+
presents some build error that does not trigger any bulid failure, so maybe
49+
they must be corrected first.
50+
-->
4551
<properties>
4652
<maven.version>3.0.5</maven.version>
4753
</properties>
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.qulice.pmd;
22

33
import org.hamcrest.Matchers;
4-
import org.junit.Assert;
5-
import org.junit.Test;
4+
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.Test;
66

77
public class AllowAssertFail {
88

99
@Test
1010
public void prohibitPlainJunitAssertionsInTests() throws Exception {
1111
Matchers.assertThat("errorMessage", "expected", Matchers.is("actual"));
12-
Assert.fail("fail test");
12+
Assertions.fail("fail test");
1313
}
1414
}

‎qulice-pmd/src/test/resources/com/qulice/pmd/ExcessiveImports.java

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import org.apache.commons.io.IOUtils;
1414
import org.hamcrest.MatcherAssert;
1515
import org.hamcrest.Matchers;
16-
import org.junit.Ignore;
17-
import org.junit.Test;
1816
import org.mockito.Mockito;
1917
import org.mockito.invocation.InvocationOnMock;
2018
import org.mockito.stubbing.Answer;

‎qulice-pmd/src/test/resources/com/qulice/pmd/PlainJUnitAssertionStaticImportBlock.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.qulice.pmd;
22

3+
import org.junit.jupiter.api.Test;
4+
35
import static org.junit.Assert.assertEquals;
4-
import org.junit.Test;
6+
57

68
public class PlainJUnitAssertionStaticImportBlock {
79

‎qulice-pmd/src/test/resources/com/qulice/pmd/PlainJUnitAssertionTestMethod.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.qulice.pmd;
22

33
import org.junit.Assert;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

66
public class PlainJUnitAssertionTestMethod {
77

2 commit comments

Comments
 (2)

0pdd commented on Feb 8, 2019

@0pdd
Collaborator

Puzzle 939-39a57206 disappeared from pom.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 commented on Feb 8, 2019

@0pdd
Collaborator

Puzzle 1019-4869c92c discovered in qulice-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.

Please sign in to comment.