@Test public void restoreOldSecurityManager() throws Throwable { SecurityManager manager = new ArbitrarySecurityManager(); setSecurityManager(manager); executeRuleWithoutExitCall(); assertThat(getSecurityManager(), sameInstance(manager)); }
@Test public void testSystemExit() { java.lang.System.setSecurityManager(new SafeExit()); EvoSuite evosuite = new EvoSuite(); String targetClass = CallExit.class.getCanonicalName(); Properties.TARGET_CLASS = targetClass; Properties.REPLACE_CALLS = true; String[] command = new String[] {"-generateSuite", "-class", targetClass}; evosuite.parseCommandLine(command); assertFalse(SafeExit.calledExit); }
@Test public void delegateToOldSecurityManager() throws Throwable { SecurityManager manager = new ArbitrarySecurityManager(); setSecurityManager(manager); executeRuleWithStatement(new CheckContext()); }
@After public void removeSecurity() { java.lang.System.setSecurityManager(null); }