1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-18 08:51:08 +01:00

sinttest: migrate to JUnit5, drop JUnit4

The before/after class annotations are now no longer borrowed from
JUnit.

Also some integration tests used @After and/or @Before from JUnit,
which was never supported nor had any effected. Those methods got
deleted. But since there appears to be a desire for such a
functionality in sinttest, we should consider adding one.
This commit is contained in:
Florian Schmaus 2020-04-12 21:54:18 +02:00
parent fdeaaf368e
commit e8fef260e6
47 changed files with 248 additions and 221 deletions

View file

@ -19,9 +19,9 @@ package org.jivesoftware.smack;
import static org.jivesoftware.smackx.jiveproperties.JivePropertiesManager.addProperty;
import static org.jivesoftware.smackx.jiveproperties.JivePropertiesManager.getProperty;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Date;
@ -34,10 +34,10 @@ import org.jivesoftware.smack.packet.StanzaBuilder;
import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
/**
* Tests for Chat Manager and for Chat Manager Listener.
@ -87,33 +87,33 @@ public class ChatTest extends AbstractSmackIntegrationTest {
newChat.sendMessage(msg);
Message msg2 = collector.nextResult(2000);
assertNotNull("No message was received", msg2);
assertEquals("Subjects are different", msg.getSubject(), msg2.getSubject());
assertEquals("Bodies are different", msg.getBody(), msg2.getBody());
assertNotNull(msg2, "No message was received");
assertEquals(msg.getSubject(), msg2.getSubject(), "Subjects are different");
assertEquals(msg.getBody(), msg2.getBody(), "Bodies are different");
assertEquals(
"favoriteColors are different",
getProperty(msg, "favoriteColor"),
getProperty(msg2, "favoriteColor"));
getProperty(msg2, "favoriteColor"),
"favoriteColors are different");
assertEquals(
"ages are different",
getProperty(msg, "age"),
getProperty(msg2, "age"));
getProperty(msg2, "age"),
"ages are different");
assertEquals(
"distances are different",
getProperty(msg, "distance"),
getProperty(msg2, "distance"));
getProperty(msg2, "distance"),
"distances are different");
assertEquals(
"weights are different",
getProperty(msg, "weight"),
getProperty(msg2, "weight"));
getProperty(msg2, "weight"),
"weights are different");
assertEquals(
"males are different",
getProperty(msg, "male"),
getProperty(msg2, "male"));
getProperty(msg2, "male"),
"males are different");
assertEquals(
"birthdates are different",
getProperty(msg, "birthdate"),
getProperty(msg2, "birthdate"));
getProperty(msg2, "birthdate"),
"birthdates are different");
}
@SuppressWarnings("deprecation")
@ -131,7 +131,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
chatManagerOne.addChatListener(listener);
chatManagerOne.createChat(conTwo.getUser());
assertTrue("TestChatManagerListener wasn't invoked", invoked);
assertTrue(invoked, "TestChatManagerListener wasn't invoked");
}
finally {
chatManagerOne.removeChatListener(listener);

View file

@ -29,8 +29,8 @@ import org.jivesoftware.smack.sasl.packet.SaslNonza;
import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest {

View file

@ -16,8 +16,8 @@
*/
package org.jivesoftware.smack;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.IOException;
@ -29,9 +29,9 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class StreamManagementTest extends AbstractSmackSpecificLowLevelIntegrationTest<XMPPTCPConnection> {

View file

@ -16,13 +16,13 @@
*/
package org.jivesoftware.smack;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Field;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class WaitForClosingStreamElementTest extends AbstractSmackLowLevelIntegrationTest {

View file

@ -25,8 +25,8 @@ import org.igniterealtime.smack.XmppConnectionStressTest;
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.ErrorsWhileSendingOrReceivingException;
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.NotAllMessagesReceivedException;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class XmppConnectionIntegrationTest extends AbstractSmackLowLevelIntegrationTest {

View file

@ -27,8 +27,8 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class ModularXmppClientToServerConnectionLowLevelIntegrationTest extends AbstractSmackSpecificLowLevelIntegrationTest<ModularXmppClientToServerConnection> {

View file

@ -19,8 +19,8 @@ package org.jivesoftware.smack.chat2;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid;

View file

@ -20,8 +20,8 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.MessageBuilder;
import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid;

View file

@ -22,8 +22,8 @@ import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.packet.Presence;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.FullJid;

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smack.roster;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.concurrent.TimeoutException;
@ -26,8 +26,8 @@ import org.jivesoftware.smack.roster.packet.RosterPacket.ItemType;
import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.BareJid;