Open
Description
Description
Tests with unpermitted operation is Threads should be disabled, but they are up.
To Reproduce
- IntelliJ IDEA 2022.1.4 with latest UTBot plugin installed
- Create/open a project with JDK 8/11
- Add the following class and generate tests for it with default settings:
public class SecurityCheck {
public int read() throws Throwable {
Thread t = new Thread("fileRead") {
public void run() {
try {
new File("a.txt").createNewFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
t.start();
Thread.sleep(500);
return 10;
}
}
- Open the generated test
Expected behavior
Generated test should be disabled due to sandbox.
Actual behavior
The following method is not executed - AccessControlException is thrown (was seen in Concrete executor logs when they were informative) - that's Ok.
But the generated tests are not disabled due to Sandbox. If we run the test - file will be created.
Visual proofs (screenshots, logs, images)
public class SecurityCheckTest {
@Test
@DisplayName("read: arg_0 = SecurityCheck() -> return 10")
public void testReadReturns10() throws Throwable {
SecurityCheck securityCheck = new SecurityCheck();
int actual = securityCheck.read();
assertEquals(10, actual);
}
}
Environment
Windows 10 Pro
IntelliJ IDEA 2022.1.4
JDK 8
Originally posted by @alisevych in #790 (comment)
Metadata
Metadata
Assignees
Type
Projects
Status
Todo