Skip to content

Commit

Permalink
[#1503] allow security manager when running tests on Java 18
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Dec 6, 2021
1 parent 0911541 commit 207a50b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/test/java/picocli/AutoCompleteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package picocli;

import org.hamcrest.CoreMatchers;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.Assertion;
Expand Down Expand Up @@ -66,6 +67,12 @@
// http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup
// https://apple.stackexchange.com/a/13019
public class AutoCompleteTest {
@BeforeClass
static void beforeClass() {
// https://github.com/remkop/picocli/issues/1503
System.setProperty("java.security.manager", "allow");
}

@Rule
public final ProvideSystemProperty ansiOFF = new ProvideSystemProperty("picocli.ansi", "false");
// allows tests to set any kind of properties they like, without having to individually roll them back
Expand Down
8 changes: 7 additions & 1 deletion src/test/java/picocli/ExecuteLegacyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package picocli;

import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.*;
Expand All @@ -36,14 +37,19 @@

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

// allows tests to set any kind of properties they like, without having to individually roll them back
@Rule
public final TestRule restoreSystemProperties = new RestoreSystemProperties();

@Rule
public final ProvideSystemProperty ansiOFF = new ProvideSystemProperty("picocli.ansi", "false");

@Rule
public final SystemErrRule systemErrRule = new SystemErrRule().enableLog().muteForSuccessfulTests();

Expand Down

0 comments on commit 207a50b

Please sign in to comment.