https://kotlinlang.org logo
#announcements
Title
# announcements
j

jakub.dyszkiewicz

02/27/2017, 6:53 PM
Does anyone use Spock to test Kotlin code? If o, how do you create immutable data classes. I really would not want to pass 10 parameters via constructor 😞
m

mg6maciej

02/27/2017, 6:57 PM
jakub.dyszkiewicz: @pawel_byszewski
j

jakub.dyszkiewicz

02/27/2017, 7:00 PM
I could just hide that behind factory extension function i guess...
e

evanchooly

02/27/2017, 7:01 PM
maybe default values?
m

mg6maciej

02/27/2017, 7:02 PM
That's what I do when not even using spock.
Just factory functions. No need them to be extensions.
Just like here (but I would split that into multiple lines, cause it's too long).
j

jakub.dyszkiewicz

02/27/2017, 7:08 PM
yeah, extension is overkill
that’s actually will do, thanks! 🙂
p

pawel_byszewski

02/28/2017, 7:08 AM
IMHO there is not any nice way to do this
default values do not affect groovy code
in byte code Kotlin puts default values to every method/constructor call
3 Views