1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +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

@ -124,7 +124,6 @@ allprojects {
junit4Projects = [ junit4Projects = [
':smack-core', ':smack-core',
':smack-im', ':smack-im',
':smack-integration-test',
':smack-omemo', ':smack-omemo',
':smack-omemo-signal', ':smack-omemo-signal',
':smack-openpgp', ':smack-openpgp',

View file

@ -12,14 +12,7 @@ dependencies {
compile 'org.reflections:reflections:0.9.11' compile 'org.reflections:reflections:0.9.11'
compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1' compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1'
compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion" compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
// Note that the junit-vintage-engine runtime dependency is not api "org.junit.jupiter:junit-jupiter-api:$junitVersion"
// directly required, but it declares a dependency to
// junit:junit:4.12, which we currently need in sinttest, since it
// (ab)uses @Before from org.junit
compile "org.junit.vintage:junit-vintage-engine:$junitVersion"
compile 'junit:junit:4.12'
// Add Junit 5 API for e.g. assertThrows()
implementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testFixturesApi(testFixtures(project(":smack-core"))) testFixturesApi(testFixtures(project(":smack-core")))
testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests" testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
} }

View file

@ -65,8 +65,9 @@ import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
import org.jivesoftware.smackx.iqregister.AccountManager; import org.jivesoftware.smackx.iqregister.AccountManager;
import org.igniterealtime.smack.inttest.Configuration.AccountRegistration; import org.igniterealtime.smack.inttest.Configuration.AccountRegistration;
import org.junit.AfterClass; import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.junit.BeforeClass; import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.reflections.Reflections; import org.reflections.Reflections;
import org.reflections.scanners.MethodAnnotationsScanner; import org.reflections.scanners.MethodAnnotationsScanner;
import org.reflections.scanners.MethodParameterScanner; import org.reflections.scanners.MethodParameterScanner;

View file

@ -0,0 +1,30 @@
/**
*
* Copyright 2020 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.igniterealtime.smack.inttest.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AfterClass {
}

View file

@ -0,0 +1,30 @@
/**
*
* Copyright 2020 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.igniterealtime.smack.inttest.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface BeforeClass {
}

View file

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.igniterealtime.smack.inttest; package org.igniterealtime.smack.inttest.annotations;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;

View file

@ -0,0 +1,21 @@
/**
*
* Copyright 2020 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Java annotations for Smack's Integration Test Framework.
*/
package org.igniterealtime.smack.inttest.annotations;

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

View file

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

View file

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

View file

@ -16,13 +16,13 @@
*/ */
package org.jivesoftware.smack; package org.jivesoftware.smack;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class WaitForClosingStreamElementTest extends AbstractSmackLowLevelIntegrationTest { 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.ErrorsWhileSendingOrReceivingException;
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.NotAllMessagesReceivedException; import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.NotAllMessagesReceivedException;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class XmppConnectionIntegrationTest extends AbstractSmackLowLevelIntegrationTest { public class XmppConnectionIntegrationTest extends AbstractSmackLowLevelIntegrationTest {

View file

@ -27,8 +27,8 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class ModularXmppClientToServerConnectionLowLevelIntegrationTest extends AbstractSmackSpecificLowLevelIntegrationTest<ModularXmppClientToServerConnection> { 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.packet.Message;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; 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.packet.MessageBuilder;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;

View file

@ -22,8 +22,8 @@ import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; 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.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.FullJid; import org.jxmpp.jid.FullJid;

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smack.roster; 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.Collection;
import java.util.concurrent.TimeoutException; 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.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; 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.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.BareJid; import org.jxmpp.jid.BareJid;

View file

@ -16,10 +16,10 @@
*/ */
package org.jivesoftware.smackx.caps; package org.jivesoftware.smackx.caps;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -45,11 +45,11 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class EntityCapsTest extends AbstractSmackIntegrationTest { public class EntityCapsTest extends AbstractSmackIntegrationTest {
@ -169,7 +169,8 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser()); DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser());
// that discovery should cause a disco#info // that discovery should cause a disco#info
assertTrue(discoInfoSend.get()); assertTrue(discoInfoSend.get());
assertTrue("The info response '" + info + "' does not contain the expected feature '" + dummyFeature + '\'', info.containsFeature(dummyFeature)); assertTrue(info.containsFeature(dummyFeature),
"The info response '" + info + "' does not contain the expected feature '" + dummyFeature + '\'');
discoInfoSend.set(false); discoInfoSend.set(false);
// discover that // discover that

View file

@ -25,10 +25,10 @@ import org.jivesoftware.smackx.chatstates.ChatStateListener;
import org.jivesoftware.smackx.chatstates.ChatStateManager; import org.jivesoftware.smackx.chatstates.ChatStateManager;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.After;
public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest { public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest {
@ -83,7 +83,7 @@ public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest {
activeSyncPoint.waitForResult(timeout); activeSyncPoint.waitForResult(timeout);
} }
@After @AfterClass
public void cleanup() { public void cleanup() {
ChatStateManager manTwo = ChatStateManager.getInstance(conTwo); ChatStateManager manTwo = ChatStateManager.getInstance(conTwo);
manTwo.removeChatStateListener(composingListener); manTwo.removeChatStateListener(composingListener);

View file

@ -28,8 +28,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint; import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest { public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -24,18 +24,17 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.NotLoggedInException; import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.geoloc.GeoLocationListener; import org.jivesoftware.smackx.geoloc.GeoLocationListener;
import org.jivesoftware.smackx.geoloc.GeoLocationManager; import org.jivesoftware.smackx.geoloc.GeoLocationManager;
import org.jivesoftware.smackx.geoloc.packet.GeoLocation; import org.jivesoftware.smackx.geoloc.packet.GeoLocation;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.AfterClass;
import org.jxmpp.jid.BareJid; import org.jxmpp.jid.BareJid;
import org.jxmpp.util.XmppDateTime; import org.jxmpp.util.XmppDateTime;

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.httpfileupload; package org.jivesoftware.smackx.httpfileupload;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -33,9 +33,9 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest { public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.iot; package org.jivesoftware.smackx.iot;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@ -31,8 +31,8 @@ import org.jivesoftware.smackx.iot.control.element.SetBoolData;
import org.jivesoftware.smackx.iot.control.element.SetData; import org.jivesoftware.smackx.iot.control.element.SetData;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; 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.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smackx.iot; package org.jivesoftware.smackx.iot;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -35,8 +35,8 @@ import org.jivesoftware.smackx.iot.data.element.NodeElement;
import org.jivesoftware.smackx.iot.data.element.TimestampElement; import org.jivesoftware.smackx.iot.data.element.TimestampElement;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; 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.IntegrationTestRosterUtil;
public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest { public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.iot; package org.jivesoftware.smackx.iot;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
@ -31,9 +31,9 @@ import org.jivesoftware.smackx.iot.discovery.ThingState;
import org.jivesoftware.smackx.iot.discovery.element.IoTClaimed; import org.jivesoftware.smackx.iot.discovery.element.IoTClaimed;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
public class IoTDiscoveryIntegrationTest extends AbstractSmackIntegrationTest { public class IoTDiscoveryIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smackx.iqversion; package org.jivesoftware.smackx.iqversion;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -26,8 +26,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smackx.iqversion.packet.Version; import org.jivesoftware.smackx.iqversion.packet.Version;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class VersionIntegrationTest extends AbstractSmackIntegrationTest { public class VersionIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -16,9 +16,9 @@
*/ */
package org.jivesoftware.smackx.mam; package org.jivesoftware.smackx.mam;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -38,9 +38,9 @@ import org.jivesoftware.smackx.mam.MamManager.MamQuery;
import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs; import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;

View file

@ -20,11 +20,11 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.AfterClass;
public class MoodIntegrationTest extends AbstractSmackIntegrationTest { public class MoodIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smackx.muc; package org.jivesoftware.smackx.muc;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List; import java.util.List;
@ -35,9 +35,9 @@ import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceExceptio
import org.jivesoftware.smackx.muc.packet.MUCUser; import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint; import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.muc; package org.jivesoftware.smackx.muc;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException; import java.io.IOException;
@ -30,9 +30,9 @@ import org.jivesoftware.smackx.muc.MultiUserChat.MucCreateConfigFormHandle;
import org.jivesoftware.smackx.muc.bookmarkautojoin.MucBookmarkAutojoinManager; import org.jivesoftware.smackx.muc.bookmarkautojoin.MucBookmarkAutojoinManager;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Localpart; import org.jxmpp.jid.parts.Localpart;

View file

@ -16,20 +16,19 @@
*/ */
package org.jivesoftware.smackx.omemo; package org.jivesoftware.smackx.omemo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Level;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
/** /**
* Abstract OMEMO integration test framing, which creates and initializes two OmemoManagers (for conOne and conTwo). * Abstract OMEMO integration test framing, which creates and initializes two OmemoManagers (for conOne and conTwo).
@ -51,7 +50,6 @@ public abstract class AbstractTwoUsersOmemoIntegrationTest extends AbstractOmemo
alice = OmemoManagerSetupHelper.prepareOmemoManager(conOne); alice = OmemoManagerSetupHelper.prepareOmemoManager(conOne);
bob = OmemoManagerSetupHelper.prepareOmemoManager(conTwo); bob = OmemoManagerSetupHelper.prepareOmemoManager(conTwo);
LOGGER.log(Level.FINE, "Alice: " + alice.getOwnDevice() + " Bob: " + bob.getOwnDevice());
assertFalse(alice.getDeviceId().equals(bob.getDeviceId())); assertFalse(alice.getDeviceId().equals(bob.getDeviceId()));
// Subscribe presences // Subscribe presences

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smackx.omemo; package org.jivesoftware.smackx.omemo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
@ -26,9 +26,9 @@ import org.jivesoftware.smack.packet.MessageBuilder;
import org.jivesoftware.smackx.omemo.element.OmemoBundleElement; import org.jivesoftware.smackx.omemo.element.OmemoBundleElement;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
/** /**
* Simple OMEMO message encryption integration test. * Simple OMEMO message encryption integration test.
@ -85,8 +85,8 @@ public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoInteg
b2 = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice()); b2 = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice());
} }
assertEquals("Alice sent bob a preKeyMessage, so her bundle MUST still be the same.", a1, a1_); assertEquals(a1, a1_, "Alice sent bob a preKeyMessage, so her bundle MUST still be the same.");
assertNotEquals("Bob just received a preKeyMessage from alice, so his bundle must have changed.", b1, b2); assertNotEquals(b1, b2, "Bob just received a preKeyMessage from alice, so his bundle must have changed.");
// Message B -> A // Message B -> A
final String body3 = "The german words for 'leek' and 'wimp' are the same."; final String body3 = "The german words for 'leek' and 'wimp' are the same.";
@ -103,9 +103,9 @@ public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoInteg
OmemoBundleElement a1__ = alice.getOmemoService().getOmemoStoreBackend().packOmemoBundle(alice.getOwnDevice()); OmemoBundleElement a1__ = alice.getOmemoService().getOmemoStoreBackend().packOmemoBundle(alice.getOwnDevice());
OmemoBundleElement b2_ = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice()); OmemoBundleElement b2_ = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice());
assertEquals("Since alice initiated the session with bob, at no time he sent a preKeyMessage, " + assertEquals(a1_, a1__, "Since alice initiated the session with bob, at no time he sent a preKeyMessage, " +
"so her bundle MUST still be the same.", a1_, a1__); "so her bundle MUST still be the same.");
assertEquals("Bob changed his bundle earlier, but at this point his bundle must be equal to " + assertEquals(b2, b2_, "Bob changed his bundle earlier, but at this point his bundle must be equal to " +
"after the first change.", b2, b2_); "after the first change.");
} }
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.omemo; package org.jivesoftware.smackx.omemo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -32,9 +32,9 @@ import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException; import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException;
import org.jivesoftware.smackx.omemo.util.MessageOrOmemoMessage; import org.jivesoftware.smackx.omemo.util.MessageOrOmemoMessage;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
/** /**
* This test sends a message from Alice to Bob, while Bob has automatic decryption disabled. * This test sends a message from Alice to Bob, while Bob has automatic decryption disabled.

View file

@ -16,9 +16,9 @@
*/ */
package org.jivesoftware.smackx.omemo; package org.jivesoftware.smackx.omemo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
@ -40,7 +40,6 @@ import org.jivesoftware.smackx.pubsub.PubSubManager;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
public class OmemoManagerSetupHelper { public class OmemoManagerSetupHelper {

View file

@ -16,9 +16,9 @@
*/ */
package org.jivesoftware.smackx.omemo; package org.jivesoftware.smackx.omemo;
import static junit.framework.TestCase.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static junit.framework.TestCase.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static junit.framework.TestCase.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException; import java.io.IOException;
@ -29,9 +29,9 @@ import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
import org.jivesoftware.smackx.omemo.exceptions.ReadOnlyDeviceException; import org.jivesoftware.smackx.omemo.exceptions.ReadOnlyDeviceException;
import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException; import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class ReadOnlyDeviceIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest { public class ReadOnlyDeviceIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest {

View file

@ -21,9 +21,9 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.MessageBuilder; import org.jivesoftware.smack.packet.MessageBuilder;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
public class SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest { public class SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest {

View file

@ -16,10 +16,10 @@
*/ */
package org.jivesoftware.smackx.ox; package org.jivesoftware.smackx.ox;
import static junit.framework.TestCase.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static junit.framework.TestCase.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static junit.framework.TestCase.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static junit.framework.TestCase.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -44,19 +44,16 @@ import org.jivesoftware.smackx.ox.exception.MissingUserIdOnKeyException;
import org.jivesoftware.smackx.ox.exception.NoBackupFoundException; import org.jivesoftware.smackx.ox.exception.NoBackupFoundException;
import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore; import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore; import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
import org.jivesoftware.smackx.pubsub.PubSubException; import org.jivesoftware.smackx.pubsub.PubSubException;
import org.bouncycastle.openpgp.PGPException; import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing; import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing; import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.junit.After; import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.junit.AfterClass; import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.junit.Before; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.junit.BeforeClass;
import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.UnprotectedKeysProtector; import org.pgpainless.key.protection.UnprotectedKeysProtector;
@ -115,18 +112,6 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration
org.apache.commons.io.FileUtils.deleteDirectory(beforePath); org.apache.commons.io.FileUtils.deleteDirectory(beforePath);
} }
@After
@Before
public void cleanUp()
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
OpenPgpPubSubUtil.deleteSecretKeyNode(alicePepManager);
if (openPgpManager != null) {
openPgpManager.stopMetadataListener();
}
}
@SmackIntegrationTest @SmackIntegrationTest
public void test() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, public void test() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException,
NoSuchProviderException, IOException, InterruptedException, PubSubException.NotALeafNodeException, NoSuchProviderException, IOException, InterruptedException, PubSubException.NotALeafNodeException,

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smackx.ox_im; package org.jivesoftware.smackx.ox_im;
import static junit.framework.TestCase.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static junit.framework.TestCase.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -34,15 +34,13 @@ import org.jivesoftware.smackx.ox.OpenPgpManager;
import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider; import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider;
import org.jivesoftware.smackx.ox.element.SigncryptElement; import org.jivesoftware.smackx.ox.element.SigncryptElement;
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore; import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.pgpainless.decryption_verification.OpenPgpMetadata; import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.UnprotectedKeysProtector; import org.pgpainless.key.protection.UnprotectedKeysProtector;
@ -98,7 +96,6 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio
@BeforeClass @BeforeClass
@AfterClass @AfterClass
public static void deleteStore() throws IOException { public static void deleteStore() throws IOException {
LOGGER.log(Level.INFO, "Deleting storage directories...");
org.apache.commons.io.FileUtils.deleteDirectory(aliceStorePath); org.apache.commons.io.FileUtils.deleteDirectory(aliceStorePath);
org.apache.commons.io.FileUtils.deleteDirectory(bobStorePath); org.apache.commons.io.FileUtils.deleteDirectory(bobStorePath);
} }
@ -165,26 +162,4 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio
bobReceivedMessage.waitForResult(timeout); bobReceivedMessage.waitForResult(timeout);
} }
@After
public void deleteKeyMetadata()
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
OpenPgpPubSubUtil.deletePubkeysListNode(alicePepManager);
OpenPgpPubSubUtil.deletePubkeysListNode(bobPepManager);
if (aliceFingerprint != null) {
OpenPgpPubSubUtil.deletePublicKeyNode(alicePepManager, aliceFingerprint);
}
if (bobFingerprint != null) {
OpenPgpPubSubUtil.deletePublicKeyNode(bobPepManager, bobFingerprint);
}
if (aliceOpenPgp != null) {
aliceOpenPgp.stopMetadataListener();
}
if (bobOpenPgp != null) {
bobOpenPgp.stopMetadataListener();
}
}
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.ping; package org.jivesoftware.smackx.ping;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -33,8 +33,8 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
public class PingIntegrationTest extends AbstractSmackIntegrationTest { public class PingIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smackx.pubsub; package org.jivesoftware.smackx.pubsub;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
@ -28,9 +28,9 @@ import org.jivesoftware.smack.packet.StandardExtensionElement;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.DomainBareJid;
public class PubSubIntegrationTest extends AbstractSmackIntegrationTest { public class PubSubIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -26,11 +26,11 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.usertune.element.UserTuneElement; import org.jivesoftware.smackx.usertune.element.UserTuneElement;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.AfterClass;
import org.jxmpp.jid.BareJid; import org.jxmpp.jid.BareJid;
public class UserTuneIntegrationTest extends AbstractSmackIntegrationTest { public class UserTuneIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jivesoftware.smackx.xdata; package org.jivesoftware.smackx.xdata;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.fail; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.StanzaCollector; import org.jivesoftware.smack.StanzaCollector;
@ -31,8 +30,8 @@ import org.jivesoftware.smackx.xdata.FormField.Type;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
/** /**
* Tests the DataForms extensions. * Tests the DataForms extensions.
@ -109,23 +108,17 @@ public class FormTest extends AbstractSmackIntegrationTest {
// Get the message with the form to fill out // Get the message with the form to fill out
Message msg2 = collector2.nextResult(); Message msg2 = collector2.nextResult();
assertNotNull("Message not found", msg2); assertNotNull(msg2, "Message not found");
// Retrieve the form to fill out // Retrieve the form to fill out
Form formToRespond = Form.getFormFrom(msg2); Form formToRespond = Form.getFormFrom(msg2);
assertNotNull(formToRespond); assertNotNull(formToRespond);
assertNotNull(formToRespond.getField("name")); assertNotNull(formToRespond.getField("name"));
assertNotNull(formToRespond.getField("description")); assertNotNull(formToRespond.getField("description"));
// Obtain the form to send with the replies // Obtain the form to send with the replies
Form completedForm = formToRespond.createAnswerForm(); final Form completedForm = formToRespond.createAnswerForm();
assertNotNull(completedForm.getField("hidden_var")); assertNotNull(completedForm.getField("hidden_var"));
// Check that a field of type String does not accept booleans // Check that a field of type String does not accept booleans
try { assertThrows(IllegalArgumentException.class, () -> completedForm.setAnswer("name", true));
completedForm.setAnswer("name", true);
fail("A boolean value was set to a field of type String");
}
catch (IllegalArgumentException e) {
// This exception is expected.
}
completedForm.setAnswer("name", "Credit card number invalid"); completedForm.setAnswer("name", "Credit card number invalid");
completedForm.setAnswer( completedForm.setAnswer(
"description", "description",
@ -146,18 +139,18 @@ public class FormTest extends AbstractSmackIntegrationTest {
// Get the message with the completed form // Get the message with the completed form
Message msg3 = collector.nextResult(); Message msg3 = collector.nextResult();
assertNotNull("Message not found", msg3); assertNotNull(msg3, "Message not found");
// Retrieve the completed form // Retrieve the completed form
completedForm = Form.getFormFrom(msg3); final Form completedForm2 = Form.getFormFrom(msg3);
assertNotNull(completedForm); assertNotNull(completedForm2);
assertNotNull(completedForm.getField("name")); assertNotNull(completedForm2.getField("name"));
assertNotNull(completedForm.getField("description")); assertNotNull(completedForm2.getField("description"));
assertEquals( assertEquals(
completedForm.getField("name").getValues().get(0).toString(), completedForm2.getField("name").getValues().get(0).toString(),
"Credit card number invalid"); "Credit card number invalid");
assertNotNull(completedForm.getField("time")); assertNotNull(completedForm2.getField("time"));
assertNotNull(completedForm.getField("age")); assertNotNull(completedForm2.getField("age"));
assertEquals("The age is bad", "20", completedForm.getField("age").getValues().get(0).toString()); assertEquals("20", completedForm2.getField("age").getValues().get(0).toString(), "The age is bad");
} }
finally { finally {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2019 Florian Schmaus * Copyright 2019-2020 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,15 +16,15 @@
*/ */
package org.igniterealtime.smack.inttest; package org.igniterealtime.smack.inttest;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List; import java.util.List;
import org.jivesoftware.smack.AbstractXMPPConnection; import org.jivesoftware.smack.AbstractXMPPConnection;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class SmackIntegrationTestFrameWorkTest { public class SmackIntegrationTestFrameWorkTest {

View file

@ -16,7 +16,7 @@
*/ */
package org.igniterealtime.smack.inttest; package org.igniterealtime.smack.inttest;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.security.KeyManagementException; import java.security.KeyManagementException;
@ -26,7 +26,7 @@ import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration; import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration;
import org.jivesoftware.smack.tcp.XmppTcpTransportModuleDescriptor; import org.jivesoftware.smack.tcp.XmppTcpTransportModuleDescriptor;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.jxmpp.stringprep.XmppStringprepException; import org.jxmpp.stringprep.XmppStringprepException;
public class SmackIntegrationTestXmppConnectionManagerTest { public class SmackIntegrationTestXmppConnectionManagerTest {

View file

@ -17,10 +17,10 @@
package org.igniterealtime.smack.inttest.unittest; package org.igniterealtime.smack.inttest.unittest;
import static org.igniterealtime.smack.inttest.SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest; import static org.igniterealtime.smack.inttest.SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -38,25 +38,27 @@ import org.jivesoftware.smack.packet.StanzaError;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework; import org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework;
import org.igniterealtime.smack.inttest.FailedTest; import org.igniterealtime.smack.inttest.FailedTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework; import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework;
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunResult; import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunResult;
import org.junit.AfterClass; import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.junit.BeforeClass; import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.junit.Test; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
public class SmackIntegrationTestFrameworkUnitTest { public class SmackIntegrationTestFrameworkUnitTest {
private static boolean beforeClassInvoked; private static boolean beforeClassInvoked;
private static boolean afterClassInvoked; private static boolean afterClassInvoked;
@BeforeClass @BeforeAll
public static void prepareSinttestUnitTest() { public static void prepareSinttestUnitTest() {
SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = true; SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = true;
} }
@AfterClass @AfterAll
public static void disallowSinntestUnitTest() { public static void disallowSinntestUnitTest() {
SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = false; SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = false;
} }
@ -125,8 +127,8 @@ public class SmackIntegrationTestFrameworkUnitTest {
DummySmackIntegrationTestFramework sinttest = getFrameworkForUnitTest(BeforeAfterClassTest.class); DummySmackIntegrationTestFramework sinttest = getFrameworkForUnitTest(BeforeAfterClassTest.class);
sinttest.run(); sinttest.run();
assertTrue("A before class method should have been executed to this time", beforeClassInvoked); assertTrue(beforeClassInvoked, "A before class method should have been executed to this time");
assertTrue("A after class method should have been executed to this time", afterClassInvoked); assertTrue(afterClassInvoked, "A after class method should have been executed to this time");
} }
public static class BeforeAfterClassTest extends AbstractSmackIntegrationTest { public static class BeforeAfterClassTest extends AbstractSmackIntegrationTest {
@ -147,8 +149,8 @@ public class SmackIntegrationTestFrameworkUnitTest {
@SmackIntegrationTest @SmackIntegrationTest
public void test() { public void test() {
assertTrue("A before class method should have been executed to this time", beforeClassInvoked); assertTrue(beforeClassInvoked, "A before class method should have been executed to this time");
assertFalse("A after class method shouldn't have been executed to this time", afterClassInvoked); assertFalse(afterClassInvoked, "A after class method shouldn't have been executed to this time");
} }
} }
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2015 Florian Schmaus * Copyright 2015-2020 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,14 +16,15 @@
*/ */
package org.igniterealtime.smack.inttest.util; package org.igniterealtime.smack.inttest.util;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import org.jivesoftware.smack.util.Async; import org.jivesoftware.smack.util.Async;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class ResultSyncPointTest { public class ResultSyncPointTest {
@ -44,7 +45,7 @@ public class ResultSyncPointTest {
assertEquals(result, receivedResult); assertEquals(result, receivedResult);
} }
@Test(expected = TestException.class) @Test
public void exceptionTestResultSyncPoint() throws Exception { public void exceptionTestResultSyncPoint() throws Exception {
final CyclicBarrier barrier = new CyclicBarrier(2); final CyclicBarrier barrier = new CyclicBarrier(2);
final ResultSyncPoint<String, TestException> rsp = new ResultSyncPoint<>(); final ResultSyncPoint<String, TestException> rsp = new ResultSyncPoint<>();
@ -56,7 +57,7 @@ public class ResultSyncPointTest {
} }
}); });
barrier.await(); barrier.await();
rsp.waitForResult(60 * 1000); assertThrows(TestException.class, () -> rsp.waitForResult(60 * 1000));
} }
private static class TestException extends Exception { private static class TestException extends Exception {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2016 Florian Schmaus * Copyright 2016-2020 Florian Schmaus
* *
* This file is part of smack-repl. * This file is part of smack-repl.
* *
@ -20,7 +20,7 @@
*/ */
package org.igniterealtime.smack.smackrepl; package org.igniterealtime.smack.smackrepl;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class SmackReplTest { public class SmackReplTest {
/** /**