### Question:
OpenStackParser { public InstanceType parseInstanceTypeResponse (String response) throws OCCIException { Attribute vcpu, ram, name, id; InstanceType ret = new InstanceType(); SAXBuilder builder = new SAXBuilder(); builder.setValidation(false); builder.setIgnoringElementContentWhitespace(true); Document xmldoc; log.info("[OpenStackParser] Parsing instance type response..."); try { xmldoc = builder.build(new StringReader(response)); XPath xpath = XPath.newInstance(" xpath.addNamespace("ns", KEYSTONENAMESPACE); vcpu = (Attribute) xpath.selectSingleNode(xmldoc); xpath = XPath.newInstance(" xpath.addNamespace("ns", KEYSTONENAMESPACE); ram = (Attribute) xpath.selectSingleNode(xmldoc); xpath = XPath.newInstance(" xpath.addNamespace("ns", KEYSTONENAMESPACE); name = (Attribute) xpath.selectSingleNode(xmldoc); xpath = XPath.newInstance(" xpath.addNamespace("ns", KEYSTONENAMESPACE); id = (Attribute) xpath.selectSingleNode(xmldoc); if (vcpu != null && ram != null && name!= null && id != null) { ret.setCpu(Integer.parseInt(vcpu.getValue())); ret.setHref(id.getValue()); ret.setMemory(Integer.parseInt(ram.getValue())); ret.setName(name.getValue()); } else { OCCIException exception = new OCCIException(); exception.setMessage(MALFORMEDRESPONSE); log.error(MALFORMEDRESPONSE); throw exception; } } catch (JDOMException e) { log.error(e.getMessage()); } catch (IOException e) { log.error(e.getMessage()); } log.debug("[OpenStackParser] Instance type response parsed..."); return ret; }  String[] parseAuthorizationResponse(String response); String[][] parseNetworkCollectionResponse(String response); String[] parseCreatedNetworkResponse(String response); NetworkCollection parseSubnetCollectionResponse(String response); Network parseSubnetResponse(String response); StorageCollection parseStorageCollectionResponse(String response); Storage parseStorageResponse(String response); StorageCollection parseImageCollectionResponse(String response); Storage parseImageResponse(String response); ComputeCollection parseComputeCollectionResponse(String response); Compute parseComputeResponse(String response); String parseComputeInstanceTypeId(
    		String response,
    		HashMap<String, InstanceType> instanceTypes); List<Disk> parseAttachedStoragesResponse(String response); List<Nic> parseVirtualInterfacesResponse(String response); InstanceTypeCollection parseInstanceTypeCollectionResponse(String response); InstanceType parseInstanceTypeResponse(String response); Quota parseComputeQuotaResponse(String response); int parseStorageQuotaResponse(String response); ComputeState fromOpenStackComputeState(String state); String toOpenStackComputeState(ComputeState state); static final String KEYSTONENAMESPACE; static final String QUANTUMNAMESPACE; static final String PROVIDERNAMESPACE; static final String ROUTERNAMESPACE; static final String XSINAMESPACE; static final String VOLUMENAMESPACE; static final String ATOMNAMESPACE; static final String COMPUTENAMESPACE; static final String VIFNAMESPACE; static final String COMMONNAMESPACE; static final String BLOCKNAMESPACE; static final String OSVOLHOSTATTRNAMESPACE; static final String OSVOLIMAGEMETANAMESPACE; static final String OSVOLTENANTATTRNAMESPACE; }### Answer:
@Test public void testParseInstanceTypeResponse() { InstanceType results; OpenStackParser parser = new OpenStackParser(); try { results = parser.parseInstanceTypeResponse(INSTANCETYPERESPONSE); assertEquals(1, results.getCpu()); assertEquals("1", results.getHref()); assertEquals(512, results.getMemory()); assertEquals("m1.tiny", results.getName()); results = parser.parseInstanceTypeResponse(INSTANCETYPEMALFORMEDRESPONSE); fail(); } catch (OCCIException e) { assertTrue(true); } }