https://kotlinlang.org logo
Title
m

Mikhail

07/15/2022, 7:13 PM
Do relaxed mocks use default constructor values? e.g.
data class Bean(val message: String = "hello")

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

mock.message // "hello" ?
🇳🇴 1
e

ephemient

07/15/2022, 7:20 PM
you shouldn't have a design where you need to mock data classes in the first place
👍 3
m

Mikhail

07/15/2022, 7:22 PM
Yeah, but I'm mocking a
@ConfigurationProperties
object, which is a singleton in Spring's view
Anyways, thank you
m

Mattia Tommasone

07/15/2022, 8:09 PM
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

Mikhail

07/15/2022, 10:14 PM
Yeah, I know about this