Simplify class stubbing in tests