org.junit.rules.TestRule
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 | Description |
---|---|
ProvideSecurityManager(java.lang.SecurityManager manager) |
Modifier and Type | Method | Description |
---|---|---|
protected void |
after() |
|
protected void |
before() |
Copyright © 2011–2018. All rights reserved.