### Question:
ResourceModifier { public static String modifyTiers(String xmlContent, String fileName) throws APIMigrationException { Writer stringWriter = new StringWriter(); Document doc = ResourceUtil.buildDocument(xmlContent, fileName); if (doc != null) { Element rootElement = doc.getDocumentElement(); Element throttleAssertion = (Element) rootElement.getElementsByTagNameNS(Constants.TIER_THROTTLE_XMLNS, Constants.TIER_MEDIATOR_THROTTLE_ASSERTION_TAG).item(0); NodeList tierNodes = throttleAssertion.getChildNodes(); for (int i = 0; i < tierNodes.getLength(); ++i) { Node tierNode = tierNodes.item(i); if (tierNode.getNodeType() == Node.ELEMENT_NODE) { Element tierTag = (Element) tierNode; Element controlTag = (Element) tierTag.getElementsByTagNameNS(Constants.TIER_THROTTLE_XMLNS, Constants.TIER_CONTROL_TAG).item(0); Element controlPolicyTag = (Element) controlTag.getElementsByTagNameNS(Constants.TIER_WSP_XMLNS, Constants.TIER_POLICY_TAG).item(0); NodeList controlPolicyPolicyTags = controlPolicyTag.getElementsByTagNameNS(Constants.TIER_WSP_XMLNS, Constants.TIER_POLICY_TAG); for (int j = 0; j < controlPolicyPolicyTags.getLength(); ++j) { if (controlPolicyPolicyTags.item(j).getNodeType() == Node.ELEMENT_NODE) { NodeList attributeTags = ((Element) controlPolicyPolicyTags.item(j)). getElementsByTagNameNS(Constants.TIER_THROTTLE_XMLNS, Constants.TIER_ATTRIBUTES_TAG); if (attributeTags.getLength() > 0) { updateTierAttributes(doc, attributeTags.item(0)); } break; } } if (controlPolicyPolicyTags.getLength() == 0) { addTierAttributes(doc, controlPolicyTag); } } } try { doc.getDocumentElement().normalize(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, Charset.defaultCharset().toString()); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http: transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(new DOMSource(doc), new StreamResult(stringWriter)); } catch (TransformerException e) { ResourceUtil.handleException("Error occurred while saving modified " + APIConstants.WORKFLOW_EXECUTOR_LOCATION, e); } } return stringWriter.toString(); }  static String modifyWorkFlowExtensions(String xmlContent); static String modifyTiers(String xmlContent, String fileName); static String removeExecutorsFromAPILifeCycle(String apiLifeCycle); static void updateSynapseConfigs(List<SynapseDTO> synapseDTOs); static boolean decryptConsumerKeyIfEncrypted(ConsumerKeyDTO consumerKeyDTO);  }### Answer:
@Test public void testModifyTiers() throws Exception { String tiers19 = IOUtils.toString(tiers19Stream); String modifiedTiers = ResourceModifier.modifyTiers(tiers19, "tiers.xml"); Document modifiedDoc = ResourceUtil.buildDocument(modifiedTiers, "modifiedTiers"); Document expectedDoc = ResourceUtil.buildDocument(tiers110Stream, FILE_NAME_WORK_DEFAULT_TIERS_110); Assert.assertEquals(compareXMLDocuments(expectedDoc, modifiedDoc), true); }