Skip to content

Commit 1f892b9

Browse files
committed
Fixed filtering lambda types
1 parent 1197115 commit 1f892b9

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.utbot.examples.lambda
2+
3+
import org.junit.jupiter.api.Test
4+
import org.utbot.testcheckers.eq
5+
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
6+
7+
class PredicateNotExampleTest : UtValueTestCaseChecker(testClass = PredicateNotExample::class) {
8+
@Test
9+
fun testPredicateNotExample() {
10+
check(
11+
PredicateNotExample::predicateNotExample,
12+
eq(2),
13+
{ a, r -> a == 5 && r == false },
14+
{ a, r -> a != 5 && r == true },
15+
)
16+
}
17+
}

utbot-framework/src/main/kotlin/org/utbot/engine/TypeResolver.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ class TypeResolver(private val typeRegistry: TypeRegistry, private val hierarchy
206206
when {
207207
sootClass.isUtMock -> unwantedTypes += it
208208
sootClass.isArtificialEntity -> {
209-
if (sootClass.isLambda) {
210-
unwantedTypes += it
211-
} else if (keepArtificialEntities) {
209+
if (keepArtificialEntities || sootClass.isLambda) {
212210
concreteTypes += it
213211
}
214212
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.utbot.examples.lambda;
2+
3+
import java.util.function.*;
4+
5+
public class PredicateNotExample {
6+
public boolean predicateNotExample(int a) {
7+
if (Predicate.not(i -> i.equals(5)).test(a)) {
8+
return true;
9+
} else {
10+
return false;
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)