A class factory for testing methods