Open
Description
Description
Test generation using symbolic execution fails for methods containing
- new toArray method for Map keySet (added for Collections in Java 11)
- new and old toArray methods for Map entrySet
To Reproduce
Steps to reproduce the behavior:
- The following line is present in ~/.utbot/settings.properties :
useFuzzing=false
- Open/restart IntelliJ IDEA with UTBot plugin installed
- A project is opened
- Add the following class:
import java.util.HashMap;
import java.util.Map;
class A {
public String[] checkNewToArray() {
Map<String, String> namesMap = new HashMap<>();
namesMap.put("Joe", "Jane");
namesMap.put("Bill", "Anna");
String[] names = namesMap.entrySet().toArray(String[]::new);
return names;
}
}
- Initiate test generation with UTBot
- Same for the following method calls:
String[] names = namesMap.keySet().toArray(String[]::new);
String[] names = namesMap.entrySet().toArray(new String[2]);
Expected behavior
Tests are supposed to be generated.
Actual behavior
Failed to generate unit tests for class A - error popup is displayed
in 2-3 seconds after start
Visual proofs (screenshots, logs, images)
Environment
Windows 10 Pro
IntelliJ IDEA Ultimate 2022.1.3
JDK 11
Additional context
Working only with old toArray method for keySet:
String[] names = namesMap.keySet().toArray(new String[2]);
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo