Skip to content

Commit 98ad2c7

Browse files
committed
Move to JUnit5
1 parent 8ec5921 commit 98ad2c7

File tree

14 files changed

+89
-76
lines changed

14 files changed

+89
-76
lines changed

pom.xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,15 @@
146146
<version>${mavenFilteringVersion}</version>
147147
</dependency>
148148
<dependency>
149-
<groupId>junit</groupId>
150-
<artifactId>junit</artifactId>
149+
<groupId>org.mockito</groupId>
150+
<artifactId>mockito-core</artifactId>
151+
<version>5.4.0</version>
151152
<scope>test</scope>
152153
</dependency>
153154
<dependency>
154155
<groupId>org.mockito</groupId>
155-
<artifactId>mockito-core</artifactId>
156-
<version>5.4.0</version>
156+
<artifactId>mockito-junit-jupiter</artifactId>
157+
<version>4.11.0</version>
157158
<scope>test</scope>
158159
</dependency>
159160
<dependency>
@@ -162,6 +163,16 @@
162163
<version>3.24.2</version>
163164
<scope>test</scope>
164165
</dependency>
166+
<dependency>
167+
<groupId>org.junit.jupiter</groupId>
168+
<artifactId>junit-jupiter-api</artifactId>
169+
<scope>test</scope>
170+
</dependency>
171+
<dependency>
172+
<groupId>org.junit.jupiter</groupId>
173+
<artifactId>junit-jupiter-params</artifactId>
174+
<scope>test</scope>
175+
</dependency>
165176
</dependencies>
166177

167178
<reporting>

src/it/filter-main-annotation/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
</build>
3636
<dependencies>
3737
<dependency>
38-
<groupId>junit</groupId>
39-
<artifactId>junit</artifactId>
40-
<version>4.13.2</version>
38+
<groupId>org.junit.jupiter</groupId>
39+
<artifactId>junit-jupiter-api</artifactId>
40+
<version>5.10.0</version>
4141
</dependency>
4242
</dependencies>
4343
</project>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package pkg;
2-
import org.junit.Ignore;
32

4-
@Ignore("${someprop}")
3+
import org.junit.jupiter.api.Disabled;
4+
5+
@Disabled("${someprop}")
56
public class A {
6-
public static final String FILTER_A="${someprop}";
7-
public static final String FILTER_B="@someprop@";
8-
}
7+
public static final String FILTER_A="${someprop}";
8+
public static final String FILTER_B="@someprop@";
9+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package pkg;
2-
import org.junit.Ignore;
2+
import org.junit.jupiter.api.Disabled;
33

4-
@Ignore( "@someprop@")
4+
@Disabled( "@someprop@")
55
public class B {
6-
public static final String FILTER_A="${someprop}";
6+
public static final String FILTER_A="${someprop}";
77
public static final String FILTER_B="@someprop@";
88
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package pkg;
2-
import org.junit.Ignore;
32

4-
@Ignore(
3+
import org.junit.jupiter.api.Disabled;
4+
5+
@Disabled(
56
"${someprop}" +
67
"@someprop@" +
78
"${someprop}@someprop@ @someprop@${someprop}"
89
)
910

1011
public class C {
11-
}
12+
}

src/it/filter-main-annotation/src/main/java-templates/pkg/SomeClass.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package pkg;
2-
import org.junit.Ignore;
2+
import org.junit.jupiter.api.Disabled;
3+
34

45
/* some stupid doc
56
* basedir=${basedir}
6-
*
7+
*
78
* some new code
89
* et bim
910
*/
10-
@Ignore("${someprop}")
11+
@Disabled("${someprop}")
1112
public class SomeClass
1213
{
1314
public static final String VERSION = "<${project.version}>";
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
package net.batmat.maven;
22

3-
import static org.junit.Assert.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
44

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

88
public class AppTest
99
{
1010
@Test
1111
public void testApp()
1212
{
1313
assertEquals("<1.0-specialversion>", pkg.SomeClass.VERSION);
14-
assertEquals("coquinou", pkg.SomeClass.class.getAnnotation(Ignore.class).value());
14+
assertEquals("coquinou", pkg.SomeClass.class.getAnnotation(Disabled.class).value());
1515
}
1616

1717
@Test
1818
public void testA() throws Exception
1919
{
20-
assertEquals("coquinou", pkg.A.class.getAnnotation(Ignore.class).value());
20+
assertEquals("coquinou", pkg.A.class.getAnnotation(Disabled.class).value());
2121
assertEquals("coquinou", pkg.A.class.getDeclaredField("FILTER_A").get(null));
2222
assertEquals("coquinou", pkg.A.class.getDeclaredField("FILTER_B").get(null));
2323
}
@@ -29,16 +29,16 @@ public void testB() throws Exception
2929
assertEquals("coquinou", pkg.B.class.getDeclaredField("FILTER_B").get(null));
3030
}
3131

32-
@Ignore("See MOJO-2012, not sure it will ever work. To be continued...")
32+
@Disabled("See MOJO-2012, not sure it will ever work. To be continued...")
3333
@Test
3434
public void testB_TwoArobases() throws Exception
3535
{
36-
assertEquals("coquinou", pkg.B.class.getAnnotation(Ignore.class).value());
36+
assertEquals("coquinou", pkg.B.class.getAnnotation(Disabled.class).value());
3737
}
38-
38+
3939
@Test
4040
public void testC() throws Exception
4141
{
42-
assertEquals("coquinoucoquinoucoquinoucoquinou coquinoucoquinou", pkg.C.class.getAnnotation(Ignore.class).value());
42+
assertEquals("coquinoucoquinoucoquinoucoquinou coquinoucoquinou", pkg.C.class.getAnnotation(Disabled.class).value());
4343
}
4444
}

src/it/filter-main/pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
</build>
3333
<dependencies>
3434
<dependency>
35-
<groupId>junit</groupId>
36-
<artifactId>junit</artifactId>
37-
<version>4.13.2</version>
35+
<groupId>org.junit.jupiter</groupId>
36+
<artifactId>junit-jupiter-api</artifactId>
37+
<version>5.10.0</version>
38+
<scope>test</scope>
3839
</dependency>
3940
</dependencies>
4041
</project>
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package net.batmat.maven;
22

3-
import org.junit.Assert;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
45

5-
public class AppTest
6+
public class AppTest
67
{
7-
@org.junit.Test
8+
@Test
89
public void testApp()
910
{
10-
Assert.assertEquals( "<1.0-specialversion>", pkg.SomeClass.VERSION);
11+
assertEquals( "<1.0-specialversion>", pkg.SomeClass.VERSION);
1112
}
1213
}

src/it/filter-tests/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
<dependencies>
99
<dependency>
10-
<groupId>junit</groupId>
11-
<artifactId>junit</artifactId>
12-
<version>4.13.2</version>
10+
<groupId>org.junit.jupiter</groupId>
11+
<artifactId>junit-jupiter-api</artifactId>
12+
<version>5.10.0</version>
1313
<scope>test</scope>
1414
</dependency>
1515
</dependencies>

0 commit comments

Comments
 (0)