Skip to content

Commit

Permalink
Make AnyObjectValueProvider not extend any interfaces, remove unrel…
Browse files Browse the repository at this point in the history
…ated comment
  • Loading branch information
IlyaMuravjov committed Sep 15, 2023
1 parent b130123 commit 7f325a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ fun anyObjectValueProvider(idGenerator: IdentityPreservingIdGenerator<Int>) =
* 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<Int>,
) : AnyObjectValueProvider {
) : JavaValueProvider, AnyObjectValueProvider {

override fun accept(type: FuzzedType) = !isIgnored(type.classId)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -192,7 +192,7 @@ object AnyDepthNullValueProvider : AnyObjectValueProvider {
*/
class AbstractsObjectValueProvider(
val idGenerator: IdGenerator<Int>,
) : AnyObjectValueProvider {
) : JavaValueProvider, AnyObjectValueProvider {

override fun accept(type: FuzzedType) = type.classId.isRefType && !isKnownTypes(type.classId)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 7f325a4

Please sign in to comment.