Add tests for CollectHandler _write_object and _write_objects.