Closed
Description
Description
When we refer to some file relatively, we strictly rely on the current working dir. The problem is that the child process working directory differs from the test runner working directory.
It's the reason of SAT-1710 (False ExceptionInInitializerError in Spring project).
To Reproduce
Steps to reproduce the behavior:
- Open any project
- Add an empty file with the name "definitely_exists" to the root project directory
- Leave only fuzzing turned on
- Generate tests for this method:
boolean checkFileExists() {
File file = new File("./definitely_exists");
if (file.exists()) {
return true;
} else {
return false;
}
}
Expected behavior
public void testCheckFileExistsReturnsTrue() {
CMCSyncService cMCSyncService = new CMCSyncService();
boolean actual = cMCSyncService.checkFileExists();
assertTrue(actual);
}
And test passes.
Actual behavior
public void testCheckFileExistsReturnsTrue() {
CMCSyncService cMCSyncService = new CMCSyncService();
boolean actual = cMCSyncService.checkFileExists();
assertFalse(actual);
}
And test fails.
Metadata
Metadata
Assignees
Type
Projects
Status
Done