File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed
utbot-framework-test/src/test/kotlin/org/utbot/examples/stream
utbot-framework/src/main/kotlin/org/utbot/engine
utbot-sample/src/main/java/org/utbot/examples/stream Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -343,14 +343,13 @@ class BaseStreamExampleTest : UtValueTestCaseChecker(
343
343
}
344
344
345
345
@Test
346
- @Disabled(" TODO unsat type constraints https://github.com/UnitTestBot/UTBotJava/issues/253" )
347
346
fun testCustomCollectionStreamExample () {
348
347
check(
349
348
BaseStreamExample ::customCollectionStreamExample,
350
349
ignoreExecutionsNumber,
351
350
{ c, r -> c.isEmpty() && r == 0L },
352
351
{ c, r -> c.isNotEmpty() && c.size.toLong() == r },
353
- coverage = DoNotCalculate
352
+ coverage = DoNotCalculate // TODO failed coverage calculation
354
353
)
355
354
}
356
355
Original file line number Diff line number Diff line change @@ -2344,8 +2344,15 @@ class Traverser(
2344
2344
// for objects (especially objects with type equals to type parameter of generic)
2345
2345
// better than engine.
2346
2346
val types = instanceOfConstraint?.typeStorage?.possibleConcreteTypes ? : instance.possibleConcreteTypes
2347
- val methodInvocationTargets = findLibraryTargets(instance.type, methodSubSignature)
2348
- ? : findMethodInvocationTargets(types, methodSubSignature)
2347
+
2348
+ val allConcreteInvocationTargets = findMethodInvocationTargets(types, methodSubSignature)
2349
+ val libraryTargets = findLibraryTargets(instance.type, methodSubSignature)
2350
+
2351
+ // to choose only "good" targets take only library targets in case they present in all targets,
2352
+ // otherwise take all targets
2353
+ val methodInvocationTargets = libraryTargets?.takeIf {
2354
+ allConcreteInvocationTargets.containsAll(it)
2355
+ } ? : allConcreteInvocationTargets
2349
2356
2350
2357
return methodInvocationTargets
2351
2358
.map { (method, implementationClass, possibleTypes) ->
Original file line number Diff line number Diff line change @@ -410,21 +410,16 @@ long closedStreamExample(List<Integer> values) {
410
410
}
411
411
412
412
@ SuppressWarnings ({"ReplaceInefficientStreamCount" , "ConstantConditions" })
413
+ // TODO wrong generic type for data field https://github.com/UnitTestBot/UTBotJava/issues/730
413
414
long customCollectionStreamExample (CustomCollection <Integer > customCollection ) {
414
415
UtMock .assume (customCollection != null && customCollection .data != null );
415
416
416
- if (customCollection .isEmpty ()) {
417
- return customCollection .stream ().count ();
417
+ final Stream <Integer > stream = customCollection .stream ();
418
418
419
- // simplified example, does not generate branch too
420
- /*customCollection.removeIf(Objects::isNull);
421
- return customCollection.toArray().length;*/
419
+ if (customCollection .isEmpty ()) {
420
+ return stream .count ();
422
421
} else {
423
- return customCollection .stream ().count ();
424
-
425
- // simplified example, does not generate branch too
426
- /*customCollection.removeIf(Objects::isNull);
427
- return customCollection.toArray().length;*/
422
+ return stream .count ();
428
423
}
429
424
}
430
425
You can’t perform that action at this time.
0 commit comments