diff --git a/build.gradle b/build.gradle index 03237bbdf..b0a81ba9f 100644 --- a/build.gradle +++ b/build.gradle @@ -124,7 +124,6 @@ allprojects { junit4Projects = [ ':smack-core', ':smack-im', - ':smack-integration-test', ':smack-omemo', ':smack-omemo-signal', ':smack-openpgp', diff --git a/smack-integration-test/build.gradle b/smack-integration-test/build.gradle index b7bc586d0..c3e6602d4 100644 --- a/smack-integration-test/build.gradle +++ b/smack-integration-test/build.gradle @@ -12,14 +12,7 @@ dependencies { compile 'org.reflections:reflections:0.9.11' compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1' compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion" - // Note that the junit-vintage-engine runtime dependency is not - // 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" + api "org.junit.jupiter:junit-jupiter-api:$junitVersion" testFixturesApi(testFixtures(project(":smack-core"))) testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests" } diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java index a8c541d8f..e96ca0a7e 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java @@ -65,8 +65,9 @@ import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow; import org.jivesoftware.smackx.iqregister.AccountManager; import org.igniterealtime.smack.inttest.Configuration.AccountRegistration; -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; import org.reflections.Reflections; import org.reflections.scanners.MethodAnnotationsScanner; import org.reflections.scanners.MethodParameterScanner; diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/AfterClass.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/AfterClass.java new file mode 100644 index 000000000..3e567131d --- /dev/null +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/AfterClass.java @@ -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 { + +} diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/BeforeClass.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/BeforeClass.java new file mode 100644 index 000000000..49f159e9b --- /dev/null +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/BeforeClass.java @@ -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 { + +} diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTest.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SmackIntegrationTest.java similarity index 95% rename from smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTest.java rename to smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SmackIntegrationTest.java index bcbfb8e35..173b4d2e9 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SmackIntegrationTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.igniterealtime.smack.inttest; +package org.igniterealtime.smack.inttest.annotations; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/package-info.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/package-info.java new file mode 100644 index 000000000..11723cd94 --- /dev/null +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/package-info.java @@ -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; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/ChatTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/ChatTest.java index ff058b8e8..d956c92ee 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/ChatTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/ChatTest.java @@ -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); diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java index 1458b99a9..47c299671 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java @@ -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 { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java index e5e77e4b0..c9ca9095b 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java @@ -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 { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/WaitForClosingStreamElementTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/WaitForClosingStreamElementTest.java index 50ddf0123..65bf5a5a4 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/WaitForClosingStreamElementTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/WaitForClosingStreamElementTest.java @@ -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 { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/XmppConnectionIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/XmppConnectionIntegrationTest.java index 29dc527e6..4ec185c12 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/XmppConnectionIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/XmppConnectionIntegrationTest.java @@ -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 { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnectionLowLevelIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnectionLowLevelIntegrationTest.java index c5a1564c6..5d6e67bd0 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnectionLowLevelIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnectionLowLevelIntegrationTest.java @@ -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 { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java index ca76ab280..7d536f072 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java @@ -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; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java index 6118d2ed2..0b0109e98 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java @@ -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; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java index 8b73081be..305e9ae47 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java @@ -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; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java index 6f2d0a8fb..55aad5c12 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java @@ -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; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java index 8a4946e51..0a0110882 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java @@ -16,10 +16,10 @@ */ package org.jivesoftware.smackx.caps; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashSet; import java.util.Set; @@ -45,11 +45,11 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; 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.junit.AfterClass; -import org.junit.BeforeClass; public class EntityCapsTest extends AbstractSmackIntegrationTest { @@ -169,7 +169,8 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest { DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser()); // that discovery should cause a disco#info 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); // discover that diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java index 539bdb03d..6b153b3a2 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java @@ -25,10 +25,10 @@ import org.jivesoftware.smackx.chatstates.ChatStateListener; import org.jivesoftware.smackx.chatstates.ChatStateManager; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; 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.junit.After; public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest { @@ -83,7 +83,7 @@ public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest { activeSyncPoint.waitForResult(timeout); } - @After + @AfterClass public void cleanup() { ChatStateManager manTwo = ChatStateManager.getInstance(conTwo); manTwo.removeChatStateListener(composingListener); diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java index 4a0af1d50..5d536aedb 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java @@ -28,8 +28,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException; 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.ResultSyncPoint; public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java index 0c4c9f863..3909cee88 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java @@ -24,18 +24,17 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotLoggedInException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.packet.Message; + import org.jivesoftware.smackx.geoloc.GeoLocationListener; import org.jivesoftware.smackx.geoloc.GeoLocationManager; import org.jivesoftware.smackx.geoloc.packet.GeoLocation; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; 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.SimpleResultSyncPoint; - -import org.junit.AfterClass; - import org.jxmpp.jid.BareJid; import org.jxmpp.util.XmppDateTime; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java index 1d2e06914..7736c0657 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java @@ -16,7 +16,7 @@ */ 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.ByteArrayOutputStream; @@ -33,9 +33,9 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -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 HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java index 4a346479b..498493b5b 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java @@ -16,7 +16,7 @@ */ 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.concurrent.TimeoutException; @@ -31,8 +31,8 @@ import org.jivesoftware.smackx.iot.control.element.SetBoolData; import org.jivesoftware.smackx.iot.control.element.SetData; 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.Jid; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java index dc6fc538e..858eae9a7 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.iot; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collections; 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.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; public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java index 92c950a86..df6bf345e 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java @@ -16,7 +16,7 @@ */ 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.NoResponseException; @@ -31,9 +31,9 @@ import org.jivesoftware.smackx.iot.discovery.ThingState; import org.jivesoftware.smackx.iot.discovery.element.IoTClaimed; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -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; import org.jxmpp.jid.Jid; public class IoTDiscoveryIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java index 577819e11..9e903bbb8 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.iqversion; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.jivesoftware.smack.SmackException.NoResponseException; 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.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; +import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; public class VersionIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java index b0cc99584..cb4751d21 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java @@ -16,9 +16,9 @@ */ package org.jivesoftware.smackx.mam; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.List; @@ -38,9 +38,9 @@ import org.jivesoftware.smackx.mam.MamManager.MamQuery; import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -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; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.jxmpp.jid.EntityBareJid; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java index afac2dd12..3338bc4f2 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java @@ -20,11 +20,11 @@ import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; 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.SimpleResultSyncPoint; -import org.junit.AfterClass; public class MoodIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java index aee855f6a..7ba0c1d1e 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.muc; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; @@ -35,9 +35,9 @@ import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceExceptio import org.jivesoftware.smackx.muc.packet.MUCUser; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -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; import org.igniterealtime.smack.inttest.util.ResultSyncPoint; import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.EntityBareJid; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java index ba4abd160..e0f476306 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.muc; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; @@ -30,9 +30,9 @@ import org.jivesoftware.smackx.muc.MultiUserChat.MucCreateConfigFormHandle; import org.jivesoftware.smackx.muc.bookmarkautojoin.MucBookmarkAutojoinManager; import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest; -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; import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.parts.Localpart; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractTwoUsersOmemoIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractTwoUsersOmemoIntegrationTest.java index 1e324b77c..1057e695c 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractTwoUsersOmemoIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractTwoUsersOmemoIntegrationTest.java @@ -16,20 +16,19 @@ */ package org.jivesoftware.smackx.omemo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import java.io.IOException; -import java.util.logging.Level; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; 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.junit.AfterClass; -import org.junit.BeforeClass; /** * 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); bob = OmemoManagerSetupHelper.prepareOmemoManager(conTwo); - LOGGER.log(Level.FINE, "Alice: " + alice.getOwnDevice() + " Bob: " + bob.getOwnDevice()); assertFalse(alice.getDeviceId().equals(bob.getDeviceId())); // Subscribe presences diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java index 26ba5ab08..2efd1fb1a 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.omemo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPConnection; @@ -26,9 +26,9 @@ import org.jivesoftware.smack.packet.MessageBuilder; import org.jivesoftware.smackx.omemo.element.OmemoBundleElement; -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; /** * Simple OMEMO message encryption integration test. @@ -85,8 +85,8 @@ public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoInteg b2 = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice()); } - assertEquals("Alice sent bob a preKeyMessage, so her bundle MUST still be the same.", a1, a1_); - assertNotEquals("Bob just received a preKeyMessage from alice, so his bundle must have changed.", b1, b2); + assertEquals(a1, a1_, "Alice sent bob a preKeyMessage, so her bundle MUST still be the same."); + assertNotEquals(b1, b2, "Bob just received a preKeyMessage from alice, so his bundle must have changed."); // Message B -> A 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 b2_ = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice()); - assertEquals("Since alice initiated the session with bob, at no time he sent a preKeyMessage, " + - "so her bundle MUST still be the same.", a1_, a1__); - assertEquals("Bob changed his bundle earlier, but at this point his bundle must be equal to " + - "after the first change.", b2, b2_); + 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."); + assertEquals(b2, b2_, "Bob changed his bundle earlier, but at this point his bundle must be equal to " + + "after the first change."); } } diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java index ee39eec90..442643071 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java @@ -16,7 +16,7 @@ */ 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.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.util.MessageOrOmemoMessage; -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; /** * This test sends a message from Alice to Bob, while Bob has automatic decryption disabled. diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java index f330880ad..467650409 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java @@ -16,9 +16,9 @@ */ package org.jivesoftware.smackx.omemo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.util.HashMap; @@ -40,7 +40,6 @@ import org.jivesoftware.smackx.pubsub.PubSubManager; import com.google.common.collect.Maps; - public class OmemoManagerSetupHelper { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java index bed2b014d..94c671962 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java @@ -16,9 +16,9 @@ */ package org.jivesoftware.smackx.omemo; -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertFalse; -import static junit.framework.TestCase.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; 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.UndecidedOmemoIdentityException; -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 ReadOnlyDeviceIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java index 3b4391ba3..c4a649911 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java @@ -21,9 +21,9 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.MessageBuilder; -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 SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java index e5e33f39b..6ee03ddaf 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java @@ -16,10 +16,10 @@ */ package org.jivesoftware.smackx.ox; -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertNotNull; -import static junit.framework.TestCase.assertNull; -import static junit.framework.TestCase.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; 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.store.definition.OpenPgpStore; import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore; -import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil; import org.jivesoftware.smackx.pubsub.PubSubException; import org.bouncycastle.openpgp.PGPException; import org.bouncycastle.openpgp.PGPPublicKeyRing; import org.bouncycastle.openpgp.PGPSecretKeyRing; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.TestNotPossibleException; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -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; import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.protection.UnprotectedKeysProtector; @@ -115,18 +112,6 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration 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 public void test() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException, IOException, InterruptedException, PubSubException.NotALeafNodeException, diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java index 4ca076c2b..b6c5325b2 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.ox_im; -import static junit.framework.TestCase.assertFalse; -import static junit.framework.TestCase.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; 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.element.SigncryptElement; 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.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.junit.After; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.pgpainless.decryption_verification.OpenPgpMetadata; import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.protection.UnprotectedKeysProtector; @@ -98,7 +96,6 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio @BeforeClass @AfterClass 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(bobStorePath); } @@ -165,26 +162,4 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio 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(); - } - } } diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java index 6bb73b8c1..65c683093 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java @@ -16,7 +16,7 @@ */ 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.Arrays; @@ -33,8 +33,8 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; 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.jxmpp.jid.Jid; public class PingIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java index a0e0bff6c..61e66fa96 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.pubsub; -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 static org.junit.jupiter.api.Assertions.assertThrows; import org.jivesoftware.smack.SmackConfiguration; @@ -28,9 +28,9 @@ import org.jivesoftware.smack.packet.StandardExtensionElement; import org.jivesoftware.smack.packet.StanzaError; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -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; import org.jxmpp.jid.DomainBareJid; public class PubSubIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java index b8492529b..cae6c1d8d 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java @@ -26,11 +26,11 @@ import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smackx.usertune.element.UserTuneElement; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; 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.SimpleResultSyncPoint; -import org.junit.AfterClass; import org.jxmpp.jid.BareJid; public class UserTuneIntegrationTest extends AbstractSmackIntegrationTest { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java index af49c251a..f4b2de824 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java @@ -14,12 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.jivesoftware.smackx.xdata; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import org.jivesoftware.smack.SmackException.NotConnectedException; 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.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; +import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; /** * Tests the DataForms extensions. @@ -109,23 +108,17 @@ public class FormTest extends AbstractSmackIntegrationTest { // Get the message with the form to fill out Message msg2 = collector2.nextResult(); - assertNotNull("Message not found", msg2); + assertNotNull(msg2, "Message not found"); // Retrieve the form to fill out Form formToRespond = Form.getFormFrom(msg2); assertNotNull(formToRespond); assertNotNull(formToRespond.getField("name")); assertNotNull(formToRespond.getField("description")); // Obtain the form to send with the replies - Form completedForm = formToRespond.createAnswerForm(); + final Form completedForm = formToRespond.createAnswerForm(); assertNotNull(completedForm.getField("hidden_var")); // Check that a field of type String does not accept booleans - try { - completedForm.setAnswer("name", true); - fail("A boolean value was set to a field of type String"); - } - catch (IllegalArgumentException e) { - // This exception is expected. - } + assertThrows(IllegalArgumentException.class, () -> completedForm.setAnswer("name", true)); completedForm.setAnswer("name", "Credit card number invalid"); completedForm.setAnswer( "description", @@ -146,18 +139,18 @@ public class FormTest extends AbstractSmackIntegrationTest { // Get the message with the completed form Message msg3 = collector.nextResult(); - assertNotNull("Message not found", msg3); + assertNotNull(msg3, "Message not found"); // Retrieve the completed form - completedForm = Form.getFormFrom(msg3); - assertNotNull(completedForm); - assertNotNull(completedForm.getField("name")); - assertNotNull(completedForm.getField("description")); + final Form completedForm2 = Form.getFormFrom(msg3); + assertNotNull(completedForm2); + assertNotNull(completedForm2.getField("name")); + assertNotNull(completedForm2.getField("description")); assertEquals( - completedForm.getField("name").getValues().get(0).toString(), + completedForm2.getField("name").getValues().get(0).toString(), "Credit card number invalid"); - assertNotNull(completedForm.getField("time")); - assertNotNull(completedForm.getField("age")); - assertEquals("The age is bad", "20", completedForm.getField("age").getValues().get(0).toString()); + assertNotNull(completedForm2.getField("time")); + assertNotNull(completedForm2.getField("age")); + assertEquals("20", completedForm2.getField("age").getValues().get(0).toString(), "The age is bad"); } finally { diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java index 71ba75ac3..94e7ad3c8 100644 --- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java +++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019 Florian Schmaus + * Copyright 2019-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. @@ -16,15 +16,15 @@ */ package org.igniterealtime.smack.inttest; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.lang.reflect.Method; import java.util.List; import org.jivesoftware.smack.AbstractXMPPConnection; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SmackIntegrationTestFrameWorkTest { diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestXmppConnectionManagerTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestXmppConnectionManagerTest.java index 1709f2a58..7a2de6097 100644 --- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestXmppConnectionManagerTest.java +++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestXmppConnectionManagerTest.java @@ -16,7 +16,7 @@ */ 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.security.KeyManagementException; @@ -26,7 +26,7 @@ import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection; import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration; import org.jivesoftware.smack.tcp.XmppTcpTransportModuleDescriptor; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.jxmpp.stringprep.XmppStringprepException; public class SmackIntegrationTestXmppConnectionManagerTest { diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java index 9df166d51..e1398e73b 100644 --- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java +++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java @@ -17,10 +17,10 @@ package org.igniterealtime.smack.inttest.unittest; import static org.igniterealtime.smack.inttest.SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; 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.DummySmackIntegrationTestFramework; import org.igniterealtime.smack.inttest.FailedTest; -import org.igniterealtime.smack.inttest.SmackIntegrationTest; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework; import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunResult; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.igniterealtime.smack.inttest.annotations.AfterClass; +import org.igniterealtime.smack.inttest.annotations.BeforeClass; +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 { private static boolean beforeClassInvoked; private static boolean afterClassInvoked; - @BeforeClass + @BeforeAll public static void prepareSinttestUnitTest() { SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = true; } - @AfterClass + @AfterAll public static void disallowSinntestUnitTest() { SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = false; } @@ -125,8 +127,8 @@ public class SmackIntegrationTestFrameworkUnitTest { DummySmackIntegrationTestFramework sinttest = getFrameworkForUnitTest(BeforeAfterClassTest.class); sinttest.run(); - assertTrue("A before class method should have been executed to this time", beforeClassInvoked); - assertTrue("A after class method should have been executed to this time", afterClassInvoked); + assertTrue(beforeClassInvoked, "A before class method should have been executed to this time"); + assertTrue(afterClassInvoked, "A after class method should have been executed to this time"); } public static class BeforeAfterClassTest extends AbstractSmackIntegrationTest { @@ -147,8 +149,8 @@ public class SmackIntegrationTestFrameworkUnitTest { @SmackIntegrationTest public void test() { - assertTrue("A before class method should have been executed to this time", beforeClassInvoked); - assertFalse("A after class method shouldn't have been executed to this time", afterClassInvoked); + assertTrue(beforeClassInvoked, "A before class method should have been executed to this time"); + assertFalse(afterClassInvoked, "A after class method shouldn't have been executed to this time"); } } } diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java index 414a66fe7..589880204 100644 --- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java +++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java @@ -1,6 +1,6 @@ /** * - * Copyright 2015 Florian Schmaus + * Copyright 2015-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. @@ -16,14 +16,15 @@ */ 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.CyclicBarrier; import org.jivesoftware.smack.util.Async; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ResultSyncPointTest { @@ -44,7 +45,7 @@ public class ResultSyncPointTest { assertEquals(result, receivedResult); } - @Test(expected = TestException.class) + @Test public void exceptionTestResultSyncPoint() throws Exception { final CyclicBarrier barrier = new CyclicBarrier(2); final ResultSyncPoint rsp = new ResultSyncPoint<>(); @@ -56,7 +57,7 @@ public class ResultSyncPointTest { } }); barrier.await(); - rsp.waitForResult(60 * 1000); + assertThrows(TestException.class, () -> rsp.waitForResult(60 * 1000)); } private static class TestException extends Exception { diff --git a/smack-repl/src/test/java/org/igniterealtime/smack/smackrepl/SmackReplTest.java b/smack-repl/src/test/java/org/igniterealtime/smack/smackrepl/SmackReplTest.java index 1e8227014..54250f100 100644 --- a/smack-repl/src/test/java/org/igniterealtime/smack/smackrepl/SmackReplTest.java +++ b/smack-repl/src/test/java/org/igniterealtime/smack/smackrepl/SmackReplTest.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2020 Florian Schmaus * * This file is part of smack-repl. * @@ -20,7 +20,7 @@ */ package org.igniterealtime.smack.smackrepl; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SmackReplTest { /**