Skip to content

Commit 1de5cf9

Browse files
authored
Make Spring integration tests use AbstractsValueProvider (#2433)
1 parent eab0b84 commit 1de5cf9

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringIntegrationTestConcreteExecutionContext.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import org.utbot.fuzzing.JavaValueProvider
1717
import org.utbot.fuzzing.ValueProvider
1818
import org.utbot.fuzzing.providers.FieldValueProvider
1919
import org.utbot.fuzzing.providers.ObjectValueProvider
20+
import org.utbot.fuzzing.providers.anyObjectValueProvider
2021
import org.utbot.fuzzing.spring.SavedEntityValueProvider
2122
import org.utbot.fuzzing.spring.SpringBeanValueProvider
2223
import org.utbot.instrumentation.ConcreteExecutor
@@ -85,7 +86,7 @@ class SpringIntegrationTestConcreteExecutionContext(
8586
springApplicationContext.getBeansAssignableTo(classId).map { it.beanName }
8687
},
8788
relevantRepositories = relevantRepositories
88-
).withFallback(ObjectValueProvider(idGenerator))
89+
).withFallback(anyObjectValueProvider(idGenerator))
8990

9091
return delegateContext.tryCreateValueProvider(concreteExecutor, classUnderTest, idGenerator)
9192
.except { p -> p is ObjectValueProvider }

utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/JavaLanguage.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.utbot.fuzzing
22

33
import mu.KotlinLogging
4-
import org.utbot.framework.UtSettings
54
import org.utbot.framework.plugin.api.ClassId
65
import org.utbot.framework.plugin.api.ExecutableId
76
import org.utbot.framework.plugin.api.Instruction
@@ -43,9 +42,7 @@ fun defaultValueProviders(idGenerator: IdentityPreservingIdGenerator<Int>) = lis
4342
FloatValueProvider,
4443
StringValueProvider,
4544
NumberValueProvider,
46-
ObjectValueProvider(idGenerator).letIf(UtSettings.fuzzingImplementationOfAbstractClasses) { ovp ->
47-
ovp.withFallback(AbstractsObjectValueProvider(idGenerator))
48-
},
45+
anyObjectValueProvider(idGenerator),
4946
ArrayValueProvider(idGenerator),
5047
EnumValueProvider(idGenerator),
5148
ListSetValueProvider(idGenerator),

utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.utbot.fuzzing.providers
22

33
import mu.KotlinLogging
4+
import org.utbot.framework.UtSettings
45
import org.utbot.framework.plugin.api.*
56
import org.utbot.framework.plugin.api.util.*
67
import org.utbot.fuzzer.*
@@ -30,6 +31,11 @@ private fun isIgnored(type: ClassId): Boolean {
3031
|| (type.isInner && !type.isStatic)
3132
}
3233

34+
fun anyObjectValueProvider(idGenerator: IdentityPreservingIdGenerator<Int>) =
35+
ObjectValueProvider(idGenerator).letIf(UtSettings.fuzzingImplementationOfAbstractClasses) { ovp ->
36+
ovp.withFallback(AbstractsObjectValueProvider(idGenerator))
37+
}
38+
3339
class ObjectValueProvider(
3440
val idGenerator: IdGenerator<Int>,
3541
) : ValueProvider<FuzzedType, FuzzedValue, FuzzedDescription> {

0 commit comments

Comments
 (0)