How to test Event field rename using @JsonAlias instead of upcaster json document manipulation

Although the Upcaster / revision documentation seems really interesting, for simple fields renaming it feels a bit scary manipulating the json nodes.

On the other hand, The jackson serializer has some simpler approaches like @JsonAlias.

What would be the best approach for testing this renaming?
Even the upcasting testing felt a bit unatural to me.
I wondered about injecting the repository and load based on the pre stored json populated domainevents. However, i havent found the manipulation of the Repository in the latest documentation and also it is a bit not nice to expose the aggregate internal state.

Iā€™d use a Unit-Test for that. Serialize the old version and deserialize it to the new type. Use the same settings as configured for Axon and you should be fine.

1 Like