copyToMock
Specifies the selector expression that determines which annotations will be copied from the type being mocked to the generated mock.
Examples:
import dev.mokkery.options.AnnotationSelector.Companion.all
import dev.mokkery.options.AnnotationSelector.Companion.none
import dev.mokkery.options.AnnotationSelector.Companion.named
import dev.mokkery.options.AnnotationSelector.Companion.matches
mokkery {
annotations {
// No annotations
copyToMock = none
// All annotations except "example.A"
copyToMock = all - named("example.A")
// Only "example.A"
copyToMock = named("example.A")
// All annotations matching the regex "internal.*"
copyToMock = matches(Regex("internal.*"))
// Combine rules: all except "example.A" and all annotations starting with "internal"
copyToMock = all - named("example.A") - matches(Regex("internal.*"))
}
}Content copied to clipboard