### Question:
PolicyAdvice implements Serializable { public static PolicyAdvice parse(String xml) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new InputSource(new StringReader(xml))); NodeList attributes = document.getElementsByTagName("AttributeValuePair"); for (int i = 0; i < attributes.getLength(); i++) { Node node = attributes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element element2 = (Element) node; String attribute = element2.getElementsByTagName("Attribute").item(0).getAttributes().getNamedItem("name").getNodeValue(); String value = element2.getElementsByTagName("Value").item(0).getFirstChild().getNodeValue(); return PolicyAdvice.builder() .type(attribute) .value(value).build(); } } throw new IllegalArgumentException("Failed to parse policy advice"); } catch (Exception e) { throw new IllegalArgumentException(e); } }  @NonNull @Override String toString(); int getType(); static PolicyAdvice parse(String xml); static final int AUTH_LEVEL_CONDITION_ADVICE; static final int AUTH_SCHEME_CONDITION_ADVICE; static final int AUTHENTICATE_TO_REALM_CONDITION_ADVICE; static final int AUTHENTICATE_TO_SERVICE_CONDITION_ADVICE; static final int SESSION_CONDITION_ADVICE; static final int TRANSACTION_CONDITION_ADVICE; static final int UNKNOWN; }### Answer:
@Test public void testParse() { String source = "<Advices>" + "<AttributeValuePair>" + "<Attribute name=\"dummyName\"/>" + "<Value>dummyValue</Value>" + "</AttributeValuePair>" + "</Advices>"; PolicyAdvice advice = PolicyAdvice.parse(source); assertThat(advice.toString()).isEqualTo(source); }