@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) |
@NotNull org.acegisecurity.Authentication |
mockAuthentication() |
@NotNull org.acegisecurity.Authentication |
mockAuthentication(@NotNull 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 @NotNull org.acegisecurity.Authentication mockAuthentication()
@NotNull public @NotNull org.acegisecurity.Authentication mockAuthentication(@NotNull @NotNull org.acegisecurity.Authentication authentication)
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.