Skip to content

Commit b885825

Browse files
committed
[build] upgrade JUnit 4 to JUnit 5 (Jupiter)
Replace junit:junit 4.13.1 with org.junit.jupiter:junit-jupiter 5.11 and add maven-surefire-plugin 3.5.2 for JUnit Platform test discovery
1 parent fd71fc0 commit b885825

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

Mavenfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ end
8585
jar 'org.jruby:jruby-core', '9.2.0.0', :scope => :provided
8686
# for invoker generated classes we need to add javax.annotation when on Java > 8
8787
jar 'javax.annotation:javax.annotation-api', '1.3.1', :scope => :compile
88-
jar 'junit:junit', '[4.13.1,)', :scope => :test
88+
jar 'org.junit.jupiter:junit-jupiter', '5.11.4', :scope => :test
89+
90+
plugin :surefire, '3.5.2'
8991

9092
# NOTE: to build on Java 11 - installing gems fails (due old jossl) with:
9193
# load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException

pom.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ DO NOT MODIFY - GENERATED CODE
108108
<scope>compile</scope>
109109
</dependency>
110110
<dependency>
111-
<groupId>junit</groupId>
112-
<artifactId>junit</artifactId>
113-
<version>[4.13.1,)</version>
111+
<groupId>org.junit.jupiter</groupId>
112+
<artifactId>junit-jupiter</artifactId>
113+
<version>5.11.4</version>
114114
<scope>test</scope>
115115
</dependency>
116116
</dependencies>
@@ -320,6 +320,10 @@ DO NOT MODIFY - GENERATED CODE
320320
</execution>
321321
</executions>
322322
</plugin>
323+
<plugin>
324+
<artifactId>maven-surefire-plugin</artifactId>
325+
<version>3.5.2</version>
326+
</plugin>
323327
<plugin>
324328
<artifactId>maven-deploy-plugin</artifactId>
325329
<version>2.8.1</version>

src/test/java/org/jruby/ext/openssl/CipherTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.jruby.ext.openssl;
22

3-
import org.junit.*;
4-
import static org.junit.Assert.*;
3+
import org.junit.jupiter.api.Test;
4+
import static org.junit.jupiter.api.Assertions.*;
55

66
/**
77
* @author kares

src/test/java/org/jruby/ext/openssl/SecurityHelperTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
package org.jruby.ext.openssl;
33

4-
import static org.junit.Assert.assertEquals;
5-
import static org.junit.Assert.assertNotNull;
6-
import static org.junit.Assert.assertNull;
7-
import static org.junit.Assert.assertSame;
8-
import static org.junit.Assert.fail;
4+
import static org.junit.jupiter.api.Assertions.assertEquals;
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
6+
import static org.junit.jupiter.api.Assertions.assertNull;
7+
import static org.junit.jupiter.api.Assertions.assertSame;
8+
import static org.junit.jupiter.api.Assertions.fail;
99

1010
import java.security.KeyStoreException;
1111
import java.security.NoSuchAlgorithmException;
@@ -15,9 +15,9 @@
1515
import java.security.cert.CertificateException;
1616
import java.security.cert.CertificateFactory;
1717

18-
import org.junit.After;
19-
import org.junit.Before;
20-
import org.junit.Test;
18+
import org.junit.jupiter.api.AfterEach;
19+
import org.junit.jupiter.api.BeforeEach;
20+
import org.junit.jupiter.api.Test;
2121

2222
/**
2323
* @author kares
@@ -31,12 +31,12 @@ public static void setBouncyCastleProvider() {
3131

3232
private Provider savedProvider;
3333

34-
@Before
34+
@BeforeEach
3535
public void saveSecurityProvider() {
3636
savedProvider = SecurityHelper.getSecurityProvider();
3737
}
3838

39-
@After
39+
@AfterEach
4040
public void restoreSecurityProvider() {
4141
SecurityHelper.securityProvider = savedProvider;
4242
}

src/test/java/org/jruby/ext/openssl/VersionTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424

2525
package org.jruby.ext.openssl;
2626

27-
import org.junit.Test;
28-
import org.junit.After;
27+
import org.junit.jupiter.api.Test;
28+
import org.junit.jupiter.api.AfterEach;
2929

30-
import static org.junit.Assert.assertFalse;
31-
import static org.junit.Assert.assertTrue;
30+
import static org.junit.jupiter.api.Assertions.assertFalse;
31+
import static org.junit.jupiter.api.Assertions.assertTrue;
3232

3333
import static org.jruby.ext.openssl.OpenSSL.*;
3434

3535
public class VersionTest {
3636

3737
private final String javaVersion = System.getProperty("java.version");
3838

39-
@After
39+
@AfterEach
4040
public void restoreJavaVersion() {
4141
System.setProperty("java.version", javaVersion);
4242
}

0 commit comments

Comments
 (0)