Do relaxed mocks use default constructor values? e...
# mockk
m
Do relaxed mocks use default constructor values? e.g.
Copy code
data class Bean(val message: String = "hello")

val mock = mockk<Bean>(relaxed = true)

mock.message // "hello" ?
🚫 1
e
you shouldn't have a design where you need to mock data classes in the first place
👍 3
m
Yeah, but I'm mocking a
@ConfigurationProperties
object, which is a singleton in Spring's view
Anyways, thank you
m
also, no, relaxed mocks return a sensible default for the return type of the method being mocked
👍 1
which for strings is an empty string
m
Yeah, I know about this
285 Views