public void testErrorIQ() throws JAXBException, XMLStreamException {
IQ iq = new IQ(IQ.Type.GET);
iq.setId("id");
iq.setTo(new Jid("to", "domain"));
iq.setFrom(new Jid("from", "domain"));
IQ error = iq.createError(new StanzaError(new UndefinedCondition()));
Assert.assertEquals(error.getType(), IQ.Type.ERROR);
Assert.assertEquals(error.getId(), iq.getId());
Assert.assertEquals(error.getTo(), iq.getFrom());
Assert.assertEquals(error.getFrom(), iq.getTo());
Assert.assertEquals(error.getError().getBy(), error.getFrom());