MockedObject

class MockedObject<T>(singleton: MockedSingleton<T>, static: MockedStatic<T>?) : ScopedMock

Wraps a MockedSingleton and an optional MockedStatic to provide combined mocking of both instance and static methods on Kotlin object declarations.

When a Kotlin object has @JvmStatic methods, Kotlin compiles them as real JVM static methods. Calls from Kotlin bytecode use invokestatic, bypassing the singleton instance mock. This class transparently combines both mocking mechanisms so that @JvmStatic methods are also intercepted.

Constructors

Link copied to clipboard
constructor(singleton: MockedSingleton<T>, static: MockedStatic<T>?)

Properties

Link copied to clipboard

Returns true if static method mocking is active for this object.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun closeOnDemand()
Link copied to clipboard
open override fun isClosed(): Boolean