Description
Fuzzer tries to put arbitrary Objects into StringMap
To Reproduce
- Set fuzzing to
100% - Generate tests for the following class
publicclassStringMapextendsHashMap<String, String> {
publicStringgetAnyString() {
returnkeySet().iterator().next();
}
}Expected behavior
There's one passing and one failing test.
Actual behavior
No passing tests are generated, one of the tests fails to compile with the following error: "incompatible types: Object cannot be converted to StringstringMap.put(object, object1);".
Visual proofs (screenshots, logs, images)
/** * @utbot.classUnderTest {@link StringMap} * @utbot.methodUnderTest {@link StringMap#getAnyString()} */@Test@DisplayName("getAnyString: -> throw ClassCastException")
publicvoidtestGetAnyStringThrowsCCE() {
StringMapstringMap = newStringMap();
Objectobject = newObject();
Objectobject1 = newObject();
stringMap.put(object, object1);
/* This test fails because method [org.example.StringMap.getAnyString] produces [java.lang.ClassCastException: class java.lang.Object cannot be cast to class java.lang.String (java.lang.Object and java.lang.String are in module java.base of loader 'bootstrap')] org.example.StringMap.getAnyString(StringMap.java:7) */stringMap.getAnyString();
}
Description
Fuzzer tries to put arbitrary
ObjectsintoStringMapTo Reproduce
100%Expected behavior
There's one passing and one failing test.
Actual behavior
No passing tests are generated, one of the tests fails to compile with the following error: "incompatible types:
Objectcannot be converted toStringstringMap.put(object, object1);".Visual proofs (screenshots, logs, images)