Hi <@U8LBKF6AJ> I'm trying to utilize TDD in a Kot...
# san-diego
l
Hi @ianbrandt I'm trying to utilize TDD in a Kotlin spring boot project. I'm using data classes for my POJOs. Is there any reason to unit test a data class? It literally just has a primary constructor and it's data fields. No business logic, no methods.
r
it would make sense to add tests for POJOs only if you have a custom implementation for
equals
or id you are adapting the POJO from some other class
i
I suppose you could write an equals, hashCode, and toString smoke test to express the intent that it stays a data class? I’ve used https://jqno.nl/equalsverifier/ to do that with minimal code for Java DTOs in the past. I haven’t tried it with Kotlin yet. If you give it a shot and it works well, or doesn’t, I’d love to hear.
l
Very cool, thanks! These data classes will always remain data classes in this project. However you're right anything can happen, and someone could theoretically change that