vendredi 2 août 2019

Fail test if deprecated constructor is used?

I am writing a serialization test for a complicated data object. Whenever a new field is added to this object, the current constructor is marked as deprecated and modified to call the new constructor with null passed in for the field that was added. This object needs to be serialized. We have a serialization test, but it passes when we add a new field to the object since the null value can be serialized, even if the added field is not serializable. Is there a way to check if the constructor being used is deprecated so we can assure that the test was updated to use the new constructor? Basically, I want to fail the test if a deprecated function is used.

Aucun commentaire:

Enregistrer un commentaire