Move expectation code to a class, so people can overwrite their own implementation