Class AcegiSecurityContextRule
java.lang.Object
com.atlassian.bamboo.testutils.junit.rule.AcegiSecurityContextRule
- All Implemented Interfaces:
org.junit.rules.TestRule
@ThreadSafe
public class AcegiSecurityContextRule
extends Object
implements org.junit.rules.TestRule
A JUnit rule to be used when ACEGI security context mocking is required.
The rule will preserve security context from before the test method or test class execution (depending on whether
the rule is used as a Rule
or ClassRule
), and restore it after execution. To ensure thread safety
synchronization will be used.
The rule also provides methods for mocking the context.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) @NotNull org.acegisecurity.Authentication
@NotNull org.acegisecurity.Authentication
mockAuthentication
(@NotNull org.acegisecurity.Authentication authentication)
-
Constructor Details
-
AcegiSecurityContextRule
public AcegiSecurityContextRule()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-
mockAuthentication
@NotNull public @NotNull org.acegisecurity.Authentication mockAuthentication() -
mockAuthentication
@NotNull public @NotNull org.acegisecurity.Authentication mockAuthentication(@NotNull @NotNull org.acegisecurity.Authentication authentication)
-