Skip to content

Commit

Permalink
[#1503] use @rule to set sysprop to allow security manager on Java 18
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Dec 6, 2021
1 parent b9d3a54 commit 55417c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
9 changes: 4 additions & 5 deletions src/test/java/picocli/AutoCompleteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@
// http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup
// https://apple.stackexchange.com/a/13019
public class AutoCompleteTest {
@BeforeClass
public static void beforeClass() {
// https://github.com/remkop/picocli/issues/1503
System.setProperty("java.security.manager", "allow");
}

@Rule
// https://github.com/remkop/picocli/issues/1503
public final ProvideSystemProperty allowSecurityManager = new ProvideSystemProperty("java.security.manager", "allow");

@Rule
public final ProvideSystemProperty ansiOFF = new ProvideSystemProperty("picocli.ansi", "false");
Expand Down
9 changes: 3 additions & 6 deletions src/test/java/picocli/ExecuteLegacyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand All @@ -37,11 +36,9 @@

@SuppressWarnings("deprecation")
public class ExecuteLegacyTest {
@BeforeClass
public static void beforeClass() {
// https://github.com/remkop/picocli/issues/1503
System.setProperty("java.security.manager", "allow");
}
@Rule
// https://github.com/remkop/picocli/issues/1503
public final ProvideSystemProperty allowSecurityManager = new ProvideSystemProperty("java.security.manager", "allow");

// allows tests to set any kind of properties they like, without having to individually roll them back
@Rule
Expand Down

0 comments on commit 55417c9

Please sign in to comment.