From 7f325a4eb47cb2adc9a1e5e7cad76e3d4dc36a7b Mon Sep 17 00:00:00 2001 From: IlyaMuravjov Date: Fri, 15 Sep 2023 11:10:08 +0300 Subject: [PATCH] Make `AnyObjectValueProvider` not extend any interfaces, remove unrelated comment --- .../main/kotlin/org/utbot/fuzzing/providers/Objects.kt | 10 +++++----- .../org/utbot/fuzzing/spring/unit/InjectMocks.kt | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt index 02f485594c..14d4abfb8a 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt @@ -75,11 +75,11 @@ fun anyObjectValueProvider(idGenerator: IdentityPreservingIdGenerator) = * arbitrary types, unlike type-specific value providers that were designed to provide values of * few specific popular types (e.g. `List`, `String`, etc.). */ -interface AnyObjectValueProvider : JavaValueProvider +interface AnyObjectValueProvider class ObjectValueProvider( val idGenerator: IdGenerator, -) : AnyObjectValueProvider { +) : JavaValueProvider, AnyObjectValueProvider { override fun accept(type: FuzzedType) = !isIgnored(type.classId) @@ -147,7 +147,7 @@ class ObjectValueProvider( } @Suppress("unused") -object NullValueProvider : AnyObjectValueProvider { +object NullValueProvider : JavaValueProvider, AnyObjectValueProvider { override fun enrich(description: FuzzedDescription, type: FuzzedType, scope: Scope) { // any value in static function is ok to fuzz @@ -177,7 +177,7 @@ object NullValueProvider : AnyObjectValueProvider { * * Intended to be used as a last fallback. */ -object AnyDepthNullValueProvider : AnyObjectValueProvider { +object AnyDepthNullValueProvider : JavaValueProvider, AnyObjectValueProvider { override fun accept(type: FuzzedType) = type.classId.isRefType @@ -192,7 +192,7 @@ object AnyDepthNullValueProvider : AnyObjectValueProvider { */ class AbstractsObjectValueProvider( val idGenerator: IdGenerator, -) : AnyObjectValueProvider { +) : JavaValueProvider, AnyObjectValueProvider { override fun accept(type: FuzzedType) = type.classId.isRefType && !isKnownTypes(type.classId) diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt index 3843930e92..0ab41c973b 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt @@ -33,7 +33,6 @@ class InjectMockValueProvider( private val classUnderTest: ClassId ) : JavaValueProvider { override fun enrich(description: FuzzedDescription, type: FuzzedType, scope: Scope) { - // any value except this if (description.description.isStatic == false && scope.parameterIndex == 0 && scope.recursionDepth == 1) { scope.putProperty(INJECT_MOCK_FLAG, Unit) }