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
orClassRule
), and restore it after execution. To ensure thread safety synchronization will be used.The rule also provides methods for mocking the context.
-
-
Constructor Summary
Constructors Constructor Description AcegiSecurityContextRule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.junit.runners.model.Statement
apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
@NotNull org.acegisecurity.Authentication
mockAuthentication()
@NotNull org.acegisecurity.Authentication
mockAuthentication(@NotNull org.acegisecurity.Authentication authentication)
-
-
-
Method Detail
-
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)
-
-