``` @Value("\${test.user.count.under.test:6}") ...
# spring
r
Copy code
@Value("\${test.user.count.under.test:6}")
    var testUserCountUnderTest: Int = 6
i
Can't use lateinit for primitives, just use 0 it would be resolved to 6
r
I think thats worse than using 6 two times 🙂
t
mock it? I always found it confusing to have both spring and java set a default value, as spring is ignore in unit tests while java is ignore when running in spring
since
mockk
(assuming you are using it) supports property mocking, you can just mock the value in unit tests
i
I think thats worse than using 6 two times
Interesting, do you mind explaining to me why please? @reik.schatz
r
personally I think, for some other developer it’s harder to reason about what the intended default value should be, 0 or 6
under the aspect of readability. but I understand why you want to use 0.
i
I see, thanks for clarifying. Didn't see it that way, in Java world, it would have a default value of 0. And the SPeL giving its default value if the key isn't set