Skip to content

Commit 9adc465

Browse files
committed
Mak this work on Java 17 onwards
1 parent d429203 commit 9adc465

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ buildNumber.properties
1111

1212
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
1313
!/.mvn/wrapper/maven-wrapper.jar
14+
15+
.idea

pom.xml

+11-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<packaging>jar</packaging>
77
<version>1.0-SNAPSHOT</version>
88
<name>my-app</name>
9-
<url>http://maven.apache.org</url>
9+
<url>https://maven.apache.org</url>
1010
<dependencies>
1111
<dependency>
12-
<groupId>junit</groupId>
13-
<artifactId>junit</artifactId>
14-
<version>4.13.2</version>
12+
<groupId>org.junit.jupiter</groupId>
13+
<artifactId>junit-jupiter-api</artifactId>
14+
<version>5.9.1</version>
1515
<scope>test</scope>
1616
</dependency>
1717
</dependencies>
@@ -24,7 +24,7 @@
2424
<plugin>
2525
<groupId>org.apache.maven.plugins</groupId>
2626
<artifactId>maven-compiler-plugin</artifactId>
27-
<version>3.8.1</version>
27+
<version>3.10.1</version>
2828
</plugin>
2929
</plugins>
3030
</pluginManagement>
@@ -33,7 +33,7 @@
3333
<!-- Build an executable JAR -->
3434
<groupId>org.apache.maven.plugins</groupId>
3535
<artifactId>maven-jar-plugin</artifactId>
36-
<version>3.2.0</version>
36+
<version>3.3.0</version>
3737
<configuration>
3838
<archive>
3939
<manifest>
@@ -47,7 +47,7 @@
4747
<plugin>
4848
<groupId>org.apache.maven.plugins</groupId>
4949
<artifactId>maven-enforcer-plugin</artifactId>
50-
<version>3.0.0-M3</version>
50+
<version>3.1.0</version>
5151
<executions>
5252
<execution>
5353
<id>enforce-maven</id>
@@ -57,8 +57,11 @@
5757
<configuration>
5858
<rules>
5959
<requireMavenVersion>
60-
<version>[3.5.4,)</version>
60+
<version>[3.8.6,)</version>
6161
</requireMavenVersion>
62+
<requireJavaVersion>
63+
<version>[11,)</version>
64+
</requireJavaVersion>
6265
</rules>
6366
</configuration>
6467
</execution>

src/main/java/com/mycompany/app/App.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/**
44
* Hello world!
55
*/
6-
public class App
7-
{
6+
public class App {
87

98
private final String message = "Hello World!";
109

src/test/java/com/mycompany/app/AppTest.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package com.mycompany.app;
22

3+
import org.junit.jupiter.api.AfterEach;
4+
import org.junit.jupiter.api.BeforeEach;
5+
import org.junit.jupiter.api.Test;
6+
37
import java.io.ByteArrayOutputStream;
48
import java.io.PrintStream;
5-
import org.junit.Before;
6-
import org.junit.Test;
7-
import org.junit.After;
8-
import static org.junit.Assert.*;
9+
10+
import static org.junit.jupiter.api.Assertions.assertEquals;
11+
import static org.junit.jupiter.api.Assertions.fail;
912

1013
/**
1114
* Unit test for simple App.
@@ -15,7 +18,7 @@ public class AppTest
1518

1619
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
1720

18-
@Before
21+
@BeforeEach
1922
public void setUpStreams() {
2023
System.setOut(new PrintStream(outContent));
2124
}
@@ -40,7 +43,7 @@ public void testAppMain()
4043
}
4144
}
4245

43-
@After
46+
@AfterEach
4447
public void cleanUpStreams() {
4548
System.setOut(null);
4649
}

0 commit comments

Comments
 (0)