@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 and Description |
---|
AcegiSecurityContextRule() |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
org.acegisecurity.Authentication |
mockAuthentication() |
org.acegisecurity.Authentication |
mockAuthentication(org.acegisecurity.Authentication authentication) |
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
@NotNull public org.acegisecurity.Authentication mockAuthentication()
@NotNull public org.acegisecurity.Authentication mockAuthentication(@NotNull org.acegisecurity.Authentication authentication)
Copyright © 2018 Atlassian Software Systems Pty Ltd. All rights reserved.