Program: 91718
Project: 91718
Buggy source:
/** 
 * Tests   {@link DefaultMetadata#getHierarchyLevels()},   {@link DefaultMetadata#getHierarchyLevelNames()},  {@link DefaultMetadata#setHierarchyLevel(Collection)} and {@link DefaultMetadata#setHierarchyLevelNames(Collection)}methods.
 */
@Test @SuppressWarnings("String_Node_Str") public void testHierarchyLevels(){
  final String[] names=new String[]{"String_Node_Str","String_Node_Str"};
  final ScopeCode[] levels=new ScopeCode[]{ScopeCode.FEATURE_TYPE,ScopeCode.FEATURE};
  final DefaultMetadata metadata=new DefaultMetadata();
  assertTrue("String_Node_Str",metadata.getHierarchyLevelNames().isEmpty());
  assertTrue("String_Node_Str",metadata.getHierarchyLevels().isEmpty());
  metadata.setHierarchyLevelNames(Arrays.asList(names));
  metadata.setHierarchyLevels(Arrays.asList(levels));
  assertArrayEquals("String_Node_Str",names,metadata.getHierarchyLevelNames().toArray());
  assertArrayEquals("String_Node_Str",levels,metadata.getHierarchyLevels().toArray());
  final Collection<MetadataScope> scopes=metadata.getMetadataScopes();
  final Iterator<MetadataScope> it=scopes.iterator();
  MetadataScope scope=it.next();
  assertEquals("String_Node_Str","String_Node_Str",scope.getName().toString());
  assertEquals("String_Node_Str",ScopeCode.FEATURE_TYPE,scope.getResourceScope());
  scope=it.next();
  assertEquals("String_Node_Str","String_Node_Str",scope.getName().toString());
  assertEquals("String_Node_Str",ScopeCode.FEATURE,scope.getResourceScope());
  it.remove();
  assertFalse(it.hasNext());
  final DefaultMetadataScope c=new DefaultMetadataScope(levels[1]=ScopeCode.ATTRIBUTE_TYPE,names[1]="String_Node_Str");
  assertTrue(scopes.add(c));
  assertArrayEquals("String_Node_Str",names,metadata.getHierarchyLevelNames().toArray());
  assertArrayEquals("String_Node_Str",levels,metadata.getHierarchyLevels().toArray());
  Collection<String> n1=metadata.getHierarchyLevelNames();
  Collection<String> n2=metadata.getHierarchyLevelNames();
  assertNotSame("String_Node_Str",n1,n2);
  assertTrue("String_Node_Str",n1.equals(n2));
  assertTrue("String_Node_Str",n2.equals(n1));
  assertEquals("String_Node_Str",n1.hashCode(),n2.hashCode());
}

Fixed version (ground truth):
/** 
 * Tests   {@link DefaultMetadata#getHierarchyLevels()},   {@link DefaultMetadata#getHierarchyLevelNames()},  {@link DefaultMetadata#setHierarchyLevels(Collection)} and {@link DefaultMetadata#setHierarchyLevelNames(Collection)}methods.
 */
@Test @SuppressWarnings("String_Node_Str") public void testHierarchyLevels(){
  final String[] names=new String[]{"String_Node_Str","String_Node_Str"};
  final ScopeCode[] levels=new ScopeCode[]{ScopeCode.FEATURE_TYPE,ScopeCode.FEATURE};
  final DefaultMetadata metadata=new DefaultMetadata();
  assertTrue("String_Node_Str",metadata.getHierarchyLevelNames().isEmpty());
  assertTrue("String_Node_Str",metadata.getHierarchyLevels().isEmpty());
  metadata.setHierarchyLevelNames(Arrays.asList(names));
  metadata.setHierarchyLevels(Arrays.asList(levels));
  assertArrayEquals("String_Node_Str",names,metadata.getHierarchyLevelNames().toArray());
  assertArrayEquals("String_Node_Str",levels,metadata.getHierarchyLevels().toArray());
  final Collection<MetadataScope> scopes=metadata.getMetadataScopes();
  final Iterator<MetadataScope> it=scopes.iterator();
  MetadataScope scope=it.next();
  assertEquals("String_Node_Str","String_Node_Str",scope.getName().toString());
  assertEquals("String_Node_Str",ScopeCode.FEATURE_TYPE,scope.getResourceScope());
  scope=it.next();
  assertEquals("String_Node_Str","String_Node_Str",scope.getName().toString());
  assertEquals("String_Node_Str",ScopeCode.FEATURE,scope.getResourceScope());
  it.remove();
  assertFalse(it.hasNext());
  final DefaultMetadataScope c=new DefaultMetadataScope(levels[1]=ScopeCode.ATTRIBUTE_TYPE,names[1]="String_Node_Str");
  assertTrue(scopes.add(c));
  assertArrayEquals("String_Node_Str",names,metadata.getHierarchyLevelNames().toArray());
  assertArrayEquals("String_Node_Str",levels,metadata.getHierarchyLevels().toArray());
  Collection<String> n1=metadata.getHierarchyLevelNames();
  Collection<String> n2=metadata.getHierarchyLevelNames();
  assertNotSame("String_Node_Str",n1,n2);
  assertTrue("String_Node_Str",n1.equals(n2));
  assertTrue("String_Node_Str",n2.equals(n1));
  assertEquals("String_Node_Str",n1.hashCode(),n2.hashCode());
}