Skip to content

Commit b319ac4

Browse files
committed
Test System Rules with OpenJDK 10
Ensure that System Rules works with JDK 10. JDK 10 removed the method "getInCheck" from SecurityManager. Therefore the test for the method "getInCheck" is ignored when testing System Rules with JDK 10 or newer.
1 parent f4782eb commit b319ac4

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ addons:
1919
packages:
2020
- openjdk-6-jdk
2121
jdk:
22+
- openjdk10
2223
- oraclejdk9
2324
- oraclejdk8
2425
- openjdk7

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ System Rules supports [Travis CI](https://travis-ci.org/) (Linux) and
5454
[AppVeyor](http://www.appveyor.com/) (Windows) for continuous
5555
integration. Your pull request will be automatically build by both CI
5656
servers. On Travis CI we build your pull request with OpenJDK 6 and run test
57-
with different JDKs (Java 6 to 9).
57+
with different JDKs (Java 6 to 10).
5858

5959

6060
## Release Guide

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</parent>
1010

1111
<artifactId>system-rules</artifactId>
12-
<version>1.19.0</version>
12+
<version>1.20.0-SNAPSHOT</version>
1313
<packaging>jar</packaging>
1414

1515
<name>System Rules</name>

src/test/java/org/junit/contrib/java/lang/system/internal/NoExitSecurityManagerTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static com.github.stefanbirkner.fishbowl.Fishbowl.exceptionThrownBy;
44
import static java.util.Arrays.asList;
55
import static org.assertj.core.api.Assertions.assertThat;
6+
import static org.junit.Assume.assumeTrue;
67
import static org.mockito.Mockito.mock;
78
import static org.mockito.Mockito.mockingDetails;
89
import static org.mockito.Mockito.when;
@@ -209,6 +210,8 @@ public static class with_original_SecurityManager {
209210

210211
@Test
211212
public void getInCheck_is_delegated_to_original_security_manager() {
213+
//method "getInCheck" was removed in JDK 10
214+
skipOnJavaGreaterThan9();
212215
when(originalSecurityManager.getInCheck()).thenReturn(true);
213216
assertThat(managerWithOriginal.getInCheck()).isTrue();
214217
}
@@ -233,6 +236,13 @@ public void thread_group_of_original_security_manager_is_provided() {
233236
when(originalSecurityManager.getThreadGroup()).thenReturn(threadGroup);
234237
assertThat(managerWithOriginal.getThreadGroup()).isSameAs(threadGroup);
235238
}
239+
240+
private void skipOnJavaGreaterThan9() {
241+
String version = System.getProperty("java.version");
242+
assumeTrue(
243+
version.startsWith("1.") || version.equals("9")
244+
);
245+
}
236246
}
237247

238248
public static class without_original_SecurityManager {

0 commit comments

Comments
 (0)