public static Enabled enabled(XmlPullParser parser) throws XmlPullParserException, IOException {
        ParserUtils.assertAtStartTag(parser);
        boolean resume = ParserUtils.getBooleanAttribute(parser, "resume", false);
        String id = parser.getAttributeValue("", "id");
        String location = parser.getAttributeValue("", "location");
        int max = ParserUtils.getIntegerAttribute(parser, "max", -1);
        parser.next();
        ParserUtils.assertAtEndTag(parser);
        return new Enabled(id, resume, location, max);
    }
@Test
    public void testParseEnabled() throws Exception {
        String stanzaID = "zid615d9";
        boolean resume = true;
        String location = "test";
        int max = 42;

        String enabledStanza = XMLBuilder.create("enabled")
                .a("xmlns", "urn:xmpp:sm:3")
                .a("id", "zid615d9")
                .a("resume", String.valueOf(resume))
                .a("location", location)
                .a("max", String.valueOf(max))
                .asString(outputProperties);

        StreamManagement.Enabled enabledPacket = ParseStreamManagement.enabled(
                PacketParserUtils.getParserFor(enabledStanza));

        assertNotNull(enabledPacket);
        assertEquals(enabledPacket.getId(), stanzaID);
        assertEquals(location, enabledPacket.getLocation());
        assertEquals(resume, enabledPacket.isResumeSet());
        assertEquals(max, enabledPacket.getMaxResumptionTime());
    }