As I understand the issue it is just with the optimizer, that not whole registration framework.
I would look at some of the tests in “ITK/Modules/Numerics/Optimizersv4/test” such as:
This one has a mock metric to create a something closer to a unit test of the optimizer as opposed to a registration framework integration test. I don’t find this test to be very clean as it print too much useless information to std::cout and does not do enough comparisons and checks.
I find that the GTest library facilitates writing tests with more validation and checks.
If recommend copying some of that old optimizer test work to a new one to tests the events and demonstrate the expected behavior.