Added validate_type convenience method. Updated tests to use anonymous classes