Closed
Description
Description
Some of tests for Enum generated by Symbolic execution are instantiating with unnecessary reflection.
To Reproduce
- Run the
lrs
project in IntelliJ Idea - Install one of the latest plugin builds from main, used 2022.11.546
- Use default settings
- Use plugin to generate tests for
ThreeState
enum - Open the generated test
Expected behavior
Enums are supposed to be instantiated without reflection.
Actual behavior
There are several (not all) tests generated by Symbolic execution that use unneeded reflection.
Visual proofs (screenshots, logs, images)
Example:
///region OTHER: ERROR SUITE for method mostPositive(java.lang.Iterable)
@Test
public void testMostPositive9() throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException {
ThreeState prevNO = ThreeState.NO;
try {
ThreeState no = ThreeState.NO;
Class threeStateClazz = Class.forName("com.intellij.util.ThreeState");
setStaticField(threeStateClazz, "NO", no);
HashSet states = new HashSet();
ThreeState threeState = ThreeState.YES;
states.add(threeState);
states.add(null);
/* This test fails because method [com.intellij.util.ThreeState.mostPositive] produces [java.lang.NullPointerException]
com.intellij.util.ThreeState.mostPositive(ThreeState.java:40) */
ThreeState.mostPositive(states);
} finally {
setStaticField(ThreeState.class, "NO", prevNO);
}
}
///endregion
Environment
Windows 10 Pro
IntelliJ IDEA 2022.2.3
IntelliJ project, JDK 11
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done