Closed stephen-murby closed 6 months ago
An example of the unit tests is as such
val actual = SnowplowCustomContexts.Builder.from(serverSideEvent)
val expected = listOf( SelfDescribingJson("iglu:uk.co.autotrader/custom_context/jsonschema/1-0-0", mapOf("field" to "value")) )
assertThat(actual.toString()).isEqualTo(expected.toString()) // Currently the only way to compare
assertThat(actual.).isEqualTo(expected) // Would rather do this
Even if we only go as far as comparing this.toString()
to that.toString()
; it would stop the user having to do this themselves over and over again.
Unit testing is made difficult for consumers of the library without being able to compare like library types.
We should implement and override the equals and hashCode methods for SelfDescribingJson & SelfDescribing