package org.jboss.as.test.shared.util;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.function.Supplier;

import org.junit.Assume;

/**
 * Helper methods which help to skip tests for feature which is not yet fully working. Put the call of the method directly into
 * the failing test method, or if you want to skip whole test class, then put the method call into method annotated with
 * {@link org.junit.BeforeClass}.
 *
 * @author Josef Cacek
 */
public class AssumeTestGroupUtil {

    /**
     * Assume for test failures when running with Elytron profile enabled. It skips test in case the {@code '-Delytron'} Maven
     * argument is used (for Elytron profile activation). For legacy-security only tests.
     */
    public static void assumeElytronProfileEnabled() {
        assumeCondition("Tests failing in Elytron profile are disabled", () -> System.getProperty("elytron") == null);
    }

    /**
     * Assume for tests that fail when the security manager is enabled. This should be used sparingly and issues should
     * be filed for failing tests so a proper fix can be done.
     */
    public static void assumeSecurityManagerDisabled() {
        assumeCondition("Tests failing if the security manager is enabled.", () -> System.getSecurityManager() != null);
    }

    private static void assumeCondition(final String message, final Supplier<Boolean> assumeTrueCondition) {
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
            @Override
            public Void run() {
                Assume.assumeTrue(message, assumeTrueCondition.get());
                return null;
            }
        });
    }

}

@@ -1132,16 +1132,371 @@
 e done.%0A
+     * %3Cp%3E%0A     * Note that this checks the %7B@code security.manager%7D system property and %3Cstrong%3Enot%3C/strong%3E that the%0A     * %7B@link System#getSecurityManager()%7D is %7B@code null%7D. The property is checked so that the assumption check can be%0A     * done in a %7B@link org.junit.Before @Before%7D or %7B@link org.junit.BeforeClass @BeforeClass%7D method.%0A     * %3C/p%3E%0A
      */%0A
@@ -1649,27 +1649,38 @@
 .get
-S
+Property(%22s
 ecurity
-M
+.m
 anager
-() !
+%22) =
 = nu

Check the security.manager system property rather than the System.getSecurityManager(). The latter requires the check to be used in container while the former the check can be used in a @Before or @BeforeClass method.