public class ProvideSecurityManager
extends org.junit.rules.ExternalResource
ProvideSecurityManager rule provides an arbitrary security
manager to a test. After the test the original security manager is restored.
public void MyTest {
private final MySecurityManager securityManager
= new MySecurityManager();
@Rule
public final ProvideSecurityManager provideSecurityManager
= new ProvideSecurityManager(securityManager);
@Test
public void overrideProperty() {
assertEquals(securityManager, System.getSecurityManager());
}
}
| Constructor and Description |
|---|
ProvideSecurityManager(java.lang.SecurityManager manager) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
protected void |
before() |
Copyright © 2011-2015. All Rights Reserved.