Program: 29678
Project: 29678
Buggy source:
@Test public void testNestedExternalRefs(@Injectable final Model mockedModel){
  final RefFormat refFormat=RefFormat.URL;
  Swagger testedSwagger=new Swagger();
  final String customerURL="String_Node_Str";
  final Model customerModel=new ModelImpl();
  Map<String,Property> custProps=new HashMap<String,Property>();
  RefProperty address=new RefProperty();
  final String addressURL="String_Node_Str";
  address.set$ref(addressURL);
  custProps.put("String_Node_Str",address);
  customerModel.setProperties(custProps);
  final Model addressModel=new ModelImpl();
  Map<String,Property> addressProps=new HashMap<String,Property>();
  RefProperty contact=new RefProperty();
  final String contactURL="String_Node_Str";
  contact.set$ref(contactURL);
  addressProps.put("String_Node_Str",contact);
  addressModel.setProperties(addressProps);
  final Model contactModel=new ModelImpl();
  Property contactProp=new StringProperty();
  contactProp.setName("String_Node_Str");
  contactProp.setRequired(true);
  Map<String,Property> contactProps=new HashMap<String,Property>();
  contactProps.put("String_Node_Str",contactProp);
  contactModel.setProperties(contactProps);
  new Expectations(){
{
      cache.loadRef(customerURL,refFormat,Model.class);
      result=customerModel;
      times=1;
      cache.loadRef(addressURL,refFormat,Model.class);
      result=addressModel;
      times=1;
      cache.loadRef(contactURL,refFormat,Model.class);
      result=contactModel;
      times=1;
    }
  }
;
  String actualRef=new ExternalRefProcessor(cache,testedSwagger).processRefToExternalDefinition(customerURL,refFormat);
  assertTrue(testedSwagger.getDefinitions().get("String_Node_Str") != null);
  assertTrue(testedSwagger.getDefinitions().get("String_Node_Str") != null);
  assertTrue(testedSwagger.getDefinitions().get("String_Node_Str") != null);
  assertTrue(testedSwagger.getDefinitions().size() == 3);
}

Fixed version (ground truth):
@Test public void testNestedExternalRefs(@Injectable final Model mockedModel){
  final RefFormat refFormat=RefFormat.URL;
  Swagger testedSwagger=new Swagger();
  final String customerURL="String_Node_Str";
  final Model customerModel=new ModelImpl();
  Map<String,Property> custProps=new HashMap<String,Property>();
  RefProperty address=new RefProperty();
  final String addressURL="String_Node_Str";
  address.set$ref(addressURL);
  custProps.put("String_Node_Str",address);
  final String loyaltyURL="String_Node_Str";
  RefProperty loyaltyProp=new RefProperty();
  loyaltyProp.set$ref(loyaltyURL);
  loyaltyProp.setName("String_Node_Str");
  loyaltyProp.setRequired(true);
  custProps.put("String_Node_Str",loyaltyProp);
  customerModel.setProperties(custProps);
  final Model addressModel=new ModelImpl();
  Map<String,Property> addressProps=new HashMap<String,Property>();
  RefProperty contact=new RefProperty();
  final String contactURL="String_Node_Str";
  contact.set$ref(contactURL);
  addressProps.put("String_Node_Str",contact);
  addressModel.setProperties(addressProps);
  final Model contactModel=new ModelImpl();
  Property contactProp=new StringProperty();
  contactProp.setName("String_Node_Str");
  contactProp.setRequired(true);
  Map<String,Property> contactProps=new HashMap<String,Property>();
  contactProps.put("String_Node_Str",contactProp);
  contactModel.setProperties(contactProps);
  new Expectations(){
{
      cache.loadRef(customerURL,refFormat,Model.class);
      result=customerModel;
      times=1;
      cache.loadRef(addressURL,refFormat,Model.class);
      result=addressModel;
      times=1;
      cache.loadRef(contactURL,refFormat,Model.class);
      result=contactModel;
      times=1;
    }
  }
;
  String actualRef=new ExternalRefProcessor(cache,testedSwagger).processRefToExternalDefinition(customerURL,refFormat);
  assertTrue(testedSwagger.getDefinitions().get("String_Node_Str") != null);
  assertTrue(testedSwagger.getDefinitions().get("String_Node_Str") != null);
  assertTrue(testedSwagger.getDefinitions().get("String_Node_Str") != null);
}