mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-07 05:31:08 +01:00
Bump ErrorProne to 2.5.1 and refactor Providers a bit
This also resulted in a refactoring of the Providers and parsing Exceptions. NumberFormatException and ParseException can now be thrown directly, the wrapping in a SmackParsingException is down at a higher layer, i.e. in AbstractProvider.
This commit is contained in:
parent
1df0763f92
commit
a7b3303f3e
136 changed files with 574 additions and 551 deletions
|
|
@ -22,7 +22,6 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
|
|
@ -68,7 +67,7 @@ public class MamFinProviderTest extends MamTest {
|
|||
IQ iq = PacketParserUtils.parseStanza(IQ_LIMITED_RESULTS_EXAMPLE);
|
||||
|
||||
MamFinIQ mamFinIQ = (MamFinIQ) iq;
|
||||
assertEquals(mamFinIQ.getType(), Type.result);
|
||||
assertEquals(mamFinIQ.getType(), IQ.Type.result);
|
||||
|
||||
assertTrue(mamFinIQ.isComplete());
|
||||
assertEquals(mamFinIQ.getRSMSet().getCount(), 16);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.mam.element.MamQueryIQ;
|
||||
|
|
@ -57,7 +56,7 @@ public class MamQueryIQProviderTest {
|
|||
IQ iq1 = PacketParserUtils.parseStanza(exampleMamQueryIQ1);
|
||||
MamQueryIQ mamQueryIQ1 = (MamQueryIQ) iq1;
|
||||
|
||||
assertEquals(mamQueryIQ1.getType(), Type.set);
|
||||
assertEquals(mamQueryIQ1.getType(), IQ.Type.set);
|
||||
assertEquals(mamQueryIQ1.getQueryId(), "test");
|
||||
|
||||
DataForm dataForm1 = (DataForm) mamQueryIQ1.getExtension(DataForm.NAMESPACE);
|
||||
|
|
@ -73,7 +72,7 @@ public class MamQueryIQProviderTest {
|
|||
IQ iq2 = PacketParserUtils.parseStanza(exampleMamQueryIQ2);
|
||||
MamQueryIQ mamQueryIQ2 = (MamQueryIQ) iq2;
|
||||
|
||||
assertEquals(mamQueryIQ2.getType(), Type.result);
|
||||
assertEquals(mamQueryIQ2.getType(), IQ.Type.result);
|
||||
assertNull(mamQueryIQ2.getQueryId());
|
||||
|
||||
DataForm dataForm2 = (DataForm) mamQueryIQ2.getExtension(DataForm.NAMESPACE);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.TimeZone;
|
|||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Message.Type;
|
||||
import org.jivesoftware.smack.packet.StanzaBuilder;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
||||
|
|
@ -75,7 +74,7 @@ public class QueryArchiveTest extends MamTest {
|
|||
DelayInformation delay = new DelayInformation(date);
|
||||
Message forwardedMessage = StanzaBuilder.buildMessage("162BEBB1-F6DB-4D9A-9BD8-CFDCC801A0B2")
|
||||
.from(JidCreate.from("coven@chat.shakespeare.lit/firstwitch"))
|
||||
.ofType(Type.chat)
|
||||
.ofType(Message.Type.chat)
|
||||
.setBody("Thrice the brinded cat hath mew.")
|
||||
.build();
|
||||
|
||||
|
|
@ -93,7 +92,7 @@ public class QueryArchiveTest extends MamTest {
|
|||
Message resultMessage = mamResultExtension.getForwarded().getForwardedStanza();
|
||||
assertEquals(resultMessage.getFrom(), JidCreate.from("coven@chat.shakespeare.lit/firstwitch"));
|
||||
assertEquals(resultMessage.getStanzaId(), "162BEBB1-F6DB-4D9A-9BD8-CFDCC801A0B2");
|
||||
assertEquals(resultMessage.getType(), Type.chat);
|
||||
assertEquals(resultMessage.getType(), Message.Type.chat);
|
||||
assertEquals(resultMessage.getBody(), "Thrice the brinded cat hath mew.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import java.util.HashMap;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
|
|
@ -59,7 +58,7 @@ public class MUCLightBlockingTest {
|
|||
@Test
|
||||
public void checkGetBlockingListIQ() throws Exception {
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, null);
|
||||
mucLightBlockingIQ.setType(Type.get);
|
||||
mucLightBlockingIQ.setType(IQ.Type.get);
|
||||
mucLightBlockingIQ.setStanzaId("getblock1");
|
||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
|
||||
|
|
@ -86,7 +85,7 @@ public class MUCLightBlockingTest {
|
|||
rooms.put(JidCreate.from("chapel@shakespeare.lit"), false);
|
||||
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
|
||||
mucLightBlockingIQ.setType(Type.set);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("block1");
|
||||
|
||||
|
|
@ -100,7 +99,7 @@ public class MUCLightBlockingTest {
|
|||
users.put(JidCreate.from("hag66@shakespeare.lit"), false);
|
||||
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
|
||||
mucLightBlockingIQ.setType(Type.set);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("block2");
|
||||
|
||||
|
|
@ -116,7 +115,7 @@ public class MUCLightBlockingTest {
|
|||
rooms.put(JidCreate.from("coven@muclight.shakespeare.lit"), true);
|
||||
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, users);
|
||||
mucLightBlockingIQ.setType(Type.set);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("unblock1");
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.StandardExtensionElement;
|
||||
|
|
@ -40,7 +41,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
public class ContentElementProviderTest {
|
||||
|
||||
@Test
|
||||
public void testParsing() throws XmlPullParserException, IOException, SmackParsingException {
|
||||
public void testParsing() throws XmlPullParserException, IOException, SmackParsingException, ParseException {
|
||||
String xml = "" +
|
||||
"<content xmlns='urn:xmpp:sce:0'>\n" +
|
||||
" <payload>\n" +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue