leonard-palm / compose-state-events

A new way to implement One-Time-UI-Events (former SingleLiveEvent) in a Compose world.
Apache License 2.0
177 stars 13 forks source link

Add data class to auto generate equals() #9

Closed Alton09 closed 9 months ago

Alton09 commented 9 months ago

Currently, the StateEventWithContentTriggered class does not override equals(), which resorts to object memory addresses when comparing two instances of this class. Data classes automatically generate equals() and hashCode(). This is useful in unit tests, for example, when you want to call assertEquals() on an expected UI state with the actual state returned from the test, and the events are stored as properties within these state classes.