Open
Description
Description
Engine generates 1 execution for this method, but doesn't cover throw statement.
public static void charSeqIsNotString(CharSequence cs) {
if (cs instanceof String) {
throw new IllegalStateException("CharSequence must be not String!");
}
}
To Reproduce
Steps to reproduce the behavior:
Steps to reproduce the behavior:
- Create the mentioned method
- Make sure that fuzzing turned of (Tools -> UnitTestBot -> Code analysis, toggle must be in the rightest position)
- Use plugin to generate tests
- Open the generated test
- Run tests with coverage
Expected behavior
2 tests are supposed to be generated witch cover all statements.
Actual behavior
1 test generated that don't covers throw statement.
Visual proofs (screenshots, logs, images)
Additional context
This bug is a part of issue #820
Metadata
Metadata
Assignees
Type
Projects
Status
Done
Activity
alisevych commentedon Jun 29, 2023
Now one test is generating that covers
instanceOf
branch.@CaelmBleidd Can you please advise if symbolic engine should cover the case that condition is false?
CaelmBleidd commentedon Jun 29, 2023
If the engine covers only one branch where an object is of
String
type and doesn't cover other subtypes ofCharSequence
, it is OK (at least, it is known behaviour). It happens because allCharSequence
are treated as strings, therefore, the negation of this makes all the branches with it unreachable.So, we know about this behaviour, it is not what we want in the future, but it is too complicated to fix for now.