Fix misuse of Reflect in test code