### Question:
HttpOverXmppRespProvider extends AbstractHttpOverXmppProvider<HttpOverXmppResp> { @Override public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException { String version = parser.getAttributeValue("", ATTRIBUTE_VERSION); String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE); String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE); int statusCode = Integer.parseInt(statusCodeString); HeadersExtension headers = parseHeaders(parser); AbstractHttpOverXmpp.Data data = parseData(parser); return HttpOverXmppResp.builder().setHeaders(headers).setData(data).setStatusCode(statusCode).setStatusMessage(statusMessage).setVersion(version).build(); }  @Override HttpOverXmppResp parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment);  }### Answer:
@Test public void areAllRespAttributesCorrectlyParsed() throws Exception { String string = "<resp xmlns='urn:xmpp:http' version='1.1' statusCode='200' statusMessage='OK'/>"; HttpOverXmppRespProvider provider = new HttpOverXmppRespProvider(); XmlPullParser parser = PacketParserUtils.getParserFor(string); IQ iq = provider.parse(parser); assertTrue(iq instanceof HttpOverXmppResp); HttpOverXmppResp resp = (HttpOverXmppResp) iq; assertEquals(resp.getVersion(), "1.1"); assertEquals(resp.getStatusCode(), 200); assertEquals(resp.getStatusMessage(), "OK"); }
@Test public void areRespAttributesWothoutMessageCorrectlyParsed() throws Exception { String string = "<resp xmlns='urn:xmpp:http' version='1.1' statusCode='200'/>"; HttpOverXmppRespProvider provider = new HttpOverXmppRespProvider(); XmlPullParser parser = PacketParserUtils.getParserFor(string); IQ iq = provider.parse(parser); assertTrue(iq instanceof HttpOverXmppResp); HttpOverXmppResp resp = (HttpOverXmppResp) iq; assertEquals(resp.getVersion(), "1.1"); assertEquals(resp.getStatusCode(), 200); assertNull(resp.getStatusMessage()); }