io.mockk.impl.stub.CommonClearer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockk-common Show documentation
Show all versions of mockk-common Show documentation
Common(JS and Java) MockK module
The newest version!
package io.mockk.impl.stub
import io.mockk.MockKGateway
import io.mockk.MockKGateway.Clearer
import io.mockk.impl.log.Logger
import io.mockk.impl.log.SafeToString
class CommonClearer(
val stubRepository: StubRepository,
val safeToString: SafeToString
) : Clearer {
val log = safeToString(Logger())
override fun clear(mocks: Array, options: MockKGateway.ClearOptions) {
log.debug { "Clearing ${mocks.contentToString()} mocks $options" }
for (mock in mocks) {
stubRepository.stubFor(mock).clear(options)
}
}
override fun clearAll(options: MockKGateway.ClearOptions) {
stubRepository.allStubs.forEach {
it.clear(options)
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy