I have two classes that are both writing various records to BackendStore
, and a ComplexObject
that consists of various data records in the BackendStore
. One class creates the object from scratch which involves computing and writing various records to the backend store. The other is cloning new object records from existing ones which involves reading various records, modifying them, and then writing the modified records to the backend store. In the future, if additional records are added to the definition of ComplexObject
, I want to make sure that the ClonedObjectWriter is updated to clone the new record.
class NewObjectWriter {
NewObjectWriter(BackendStore backendStore) {...}
createComplexObject() {...}
class ClonedObjectWriter {
ClonedObjectWriter(BackendStore backendStore) {...}
cloneExistingObject(ComplexObject existingObject) {...}
}
I would like to enforce by adding a unit test that verifies that ClonedObjectWriter
is calling all the methods on the BackendStore
that NewObjectWriter
is calling so that the two classes don't go out of sync. Is this possible?
Aucun commentaire:
Enregistrer un commentaire