Skip to content

Commit 51343c8

Browse files
Upgrade JUnit from version 5.11.3 to 6.0.1 (#38)
1 parent 7061dce commit 51343c8

File tree

16 files changed

+251
-88
lines changed

16 files changed

+251
-88
lines changed

section-10-unit-testing-quick-start/00-starting-project/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -13,4 +13,4 @@
1313
<maven.compiler.target>25</maven.compiler.target>
1414
</properties>
1515

16-
</project>
16+
</project>

section-10-unit-testing-quick-start/01-assert-equals-not-equals-AND-null-not-null/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

section-10-unit-testing-quick-start/02-lifecycle-methods/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

section-10-unit-testing-quick-start/03-custom-display-name/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

section-10-unit-testing-quick-start/04-assert-same-not-same-AND-true-false/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

section-10-unit-testing-quick-start/05-project-solution-assert-array-iterable-lines/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

section-10-unit-testing-quick-start/06-assert-throws-and-timeouts/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

section-10-unit-testing-quick-start/07-order-tests/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

section-10-unit-testing-quick-start/08-conditional-tests/pom.xml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.luv2code</groupId>
@@ -18,10 +18,59 @@
1818
<dependency>
1919
<groupId>org.junit.jupiter</groupId>
2020
<artifactId>junit-jupiter</artifactId>
21-
<version>5.11.3</version>
21+
<version>6.0.1</version>
2222
<scope>test</scope>
2323
</dependency>
2424

2525
</dependencies>
2626

27-
</project>
27+
<reporting>
28+
29+
<plugins>
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-surefire-report-plugin</artifactId>
33+
<version>3.5.2</version>
34+
</plugin>
35+
36+
</plugins>
37+
38+
</reporting>
39+
40+
<build>
41+
42+
<plugins>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-site-plugin</artifactId>
46+
<version>3.21.0</version>
47+
</plugin>
48+
49+
<plugin>
50+
<groupId>org.jacoco</groupId>
51+
<artifactId>jacoco-maven-plugin</artifactId>
52+
<version>0.8.13</version>
53+
54+
<executions>
55+
<execution>
56+
<id>jacoco-prepare</id>
57+
<goals>
58+
<goal>prepare-agent</goal>
59+
</goals>
60+
</execution>
61+
62+
<execution>
63+
<id>jacoco-report</id>
64+
<phase>test</phase>
65+
<goals>
66+
<goal>report</goal>
67+
</goals>
68+
</execution>
69+
</executions>
70+
71+
</plugin>
72+
</plugins>
73+
74+
</build>
75+
76+
</project>

section-10-unit-testing-quick-start/08-conditional-tests/src/test/java/com/luv2code/junitdemo/ConditionalTest.java

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ void testForMacOnly() {
2424
// execute method and perform asserts
2525
}
2626

27-
2827
@Test
29-
@EnabledOnOs({OS.MAC, OS.WINDOWS})
28+
@EnabledOnOs({ OS.MAC, OS.WINDOWS })
3029
void testForMacAndWindowsOnly() {
3130
// execute method and perform asserts
3231
}
@@ -38,47 +37,15 @@ void testForLinuxOnly() {
3837
}
3938

4039
@Test
41-
@EnabledOnJre(JRE.JAVA_17)
42-
void testForOnlyForJava17() {
43-
// execute method and perform asserts
44-
}
45-
46-
@Test
47-
@EnabledOnJre(JRE.JAVA_13)
48-
void testOnlyForJava13() {
49-
// execute method and perform asserts
50-
}
51-
52-
@Test
53-
@EnabledForJreRange(min=JRE.JAVA_13, max=JRE.JAVA_18)
54-
void testOnlyForJavaRange() {
55-
// execute method and perform asserts
56-
}
57-
58-
@Test
59-
@EnabledForJreRange(min=JRE.JAVA_11)
60-
void testOnlyForJavaRangeMin() {
61-
// execute method and perform asserts
62-
}
63-
64-
@Test
65-
@EnabledIfEnvironmentVariable(named="LUV2CODE_ENV", matches="DEV")
40+
@EnabledIfEnvironmentVariable(named = "LUV2CODE_ENV", matches = "DEV")
6641
void testOnlyForDevEnvironment() {
6742
// execute method and perform asserts
6843
}
6944

7045
@Test
71-
@EnabledIfSystemProperty(named="LUV2CODE_SYS_PROP", matches="CI_CD_DEPLOY")
46+
@EnabledIfSystemProperty(named = "LUV2CODE_SYS_PROP", matches = "CI_CD_DEPLOY")
7247
void testOnlyForSystemProperty() {
7348
// execute method and perform asserts
7449
}
7550

7651
}
77-
78-
79-
80-
81-
82-
83-
84-

0 commit comments

Comments
 (0)