Source:
<code>public void getAttributesByNames() throws Exception { System.out.println(CLASS_NAME + "getAttributesByNames"); cacheManager.newNestedTransaction(); Attribute groupAttr = setUpGroupAttribute(); AttributeDefinition groupAttrDef = setUpGroupAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); List<String> attributeNames = new ArrayList<>(); attributeNames.add(groupAttr.getName()); attributeNames.add(groupAttrDef.getName()); List<Attribute> attrs = cacheManager.getAttributesByNames(attributeNames, groupHolder, null); assertTrue("result should contain group attribute", attrs.contains(groupAttr)); <START> assertTrue("result should contain group attribute definition", attrs.contains(new Attribute(groupAttrDef))); <END> assertTrue("it should return 2 attributes", attrs.size() == 2); cacheManager.removeAttribute(groupAttr, groupHolder, null); attrs = cacheManager.getAttributesByNames(attributeNames, groupHolder, null); assertTrue("result should not contain group attribute", !attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(new Attribute(groupAttrDef))); assertTrue("it should return 2 attribute definitions", attrs.size() == 2); cacheManager.flushNestedTransaction(); attrs = cacheManager.getAttributesByNames(attributeNames, groupHolder, null); assertTrue("result should not contain group attribute", !attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(new Attribute(groupAttrDef))); assertTrue("it should return 2 attribute definitions", attrs.size() == 2); }</code><technical_language>above</technical_language>

Target:
public void getAttributesByNames() throws Exception { System.out.println(CLASS_NAME + "getAttributesByNames"); cacheManager.newNestedTransaction(); Attribute groupAttr = setUpGroupAttribute(); AttributeDefinition groupAttrDef = setUpGroupAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); List<String> attributeNames = new ArrayList<>(); attributeNames.add(groupAttr.getName()); attributeNames.add(groupAttrDef.getName()); List<Attribute> attrs = cacheManager.getAttributesByNames(attributeNames, groupHolder, null); assertTrue("result should contain group attribute", attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(groupAttrDef)); assertTrue("it should return 2 attributes", attrs.size() == 2); cacheManager.removeAttribute(groupAttr, groupHolder, null); attrs = cacheManager.getAttributesByNames(attributeNames, groupHolder, null); assertTrue("result should not contain group attribute", !attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(groupAttrDef)); assertTrue("it should return 2 attribute definitions", attrs.size() == 2); cacheManager.flushNestedTransaction(); attrs = cacheManager.getAttributesByNames(attributeNames, groupHolder, null); assertTrue("result should not contain group attribute", !attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(groupAttrDef)); assertTrue("it should return 2 attribute definitions", attrs.size() == 2); }