Background
EntityKey is used as the key for TreeMap and TreeSet collections in the change-tracking ledger, but teaql-core currently has no unit tests.
Scope
Add a focused EntityKeyTest.
Test cases
- Keys with the same entity type and ID are equal and have the same hash code.
- Different entity types or IDs are not equal.
- Natural ordering sorts first by entity type and then by ID.
- A
null ID sorts consistently before non-null IDs of the same type.
- A null entity type is rejected.
toString() renders the stable type:id form.
Acceptance criteria
- Tests run in the
teaql-core module with JUnit 4.
- Tests cover only
EntityKey; no production behavior is changed unless a failing contract test reveals a defect.
Background
EntityKeyis used as the key forTreeMapandTreeSetcollections in the change-tracking ledger, butteaql-corecurrently has no unit tests.Scope
Add a focused
EntityKeyTest.Test cases
nullID sorts consistently before non-null IDs of the same type.toString()renders the stabletype:idform.Acceptance criteria
teaql-coremodule with JUnit 4.EntityKey; no production behavior is changed unless a failing contract test reveals a defect.