From 0897b76718e2c24b665140ecd56b7d62698bdf39 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 24 Mar 2015 21:38:21 +0100 Subject: [PATCH] Fix unit-tests initialization Remove the TestSuite class. We now have SmackTestSuite ^ | InitExtensions ^ | $UnitTest where most basic setup is done in a static block within SmackTestSuite (only stringencoder setup right now). Also some minor fixes in unit tests. --- .../sasl/core/SCRAMSHA1MechanismTest.java | 8 +--- .../smack/test/util/SmackTestSuite.java | 14 +------ .../jivesoftware/smackx/InitExtensions.java | 3 +- .../bytestreams/ibb/CloseListenerTest.java | 3 +- .../bytestreams/ibb/DataListenerTest.java | 3 +- .../smackx/bytestreams/ibb/IBBTestsSuite.java | 38 ------------------- .../ibb/InBandBytestreamManagerTest.java | 3 +- .../ibb/InBandBytestreamRequestTest.java | 3 +- .../InBandBytestreamSessionMessageTest.java | 3 +- .../ibb/InBandBytestreamSessionTest.java | 3 +- .../ibb/InitiationListenerTest.java | 3 +- .../bytestreams/ibb/packet/CloseTest.java | 3 +- .../ibb/packet/DataPacketExtensionTest.java | 3 +- .../bytestreams/ibb/packet/DataTest.java | 3 +- .../bytestreams/ibb/packet/OpenTest.java | 3 +- .../ibb/provider/OpenIQProviderTest.java | 5 ++- .../smackx/caps/EntityCapsManagerTest.java | 9 +---- .../smackx/iqversion/VersionTest.java | 3 +- .../jivesoftware/smackx/ping/PingTest.java | 7 ---- .../smackx/vcardtemp/VCardTest.java | 7 ---- .../xdatalayout/packet/DataLayoutTest.java | 3 +- .../provider/DataValidationTest.java | 13 +++---- .../provider/XHTMLExtensionProviderTest.java | 2 +- .../java/org/jivesoftware/util/Protocol.java | 6 +-- 24 files changed, 44 insertions(+), 107 deletions(-) delete mode 100644 smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBTestsSuite.java diff --git a/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java b/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java index 46e359895..93c0cb79c 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java @@ -25,11 +25,10 @@ import org.jivesoftware.smack.sasl.packet.SaslStreamElements.AuthMechanism; import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Response; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.util.stringencoder.Base64; -import org.junit.Before; import org.junit.Test; import org.jxmpp.jid.JidTestUtil; -public class SCRAMSHA1MechanismTest { +public class SCRAMSHA1MechanismTest extends SmackTestSuite { public static final String USERNAME = "user"; public static final String PASSWORD = "pencil"; @@ -38,11 +37,6 @@ public class SCRAMSHA1MechanismTest { public static final String CLIENT_FINAL_MESSAGE = "c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts="; public static final String SERVER_FINAL_MESSAGE = "v=rmF9pqV8S7suAoZWja4dJRkFsKQ="; - @Before - public void init() { - SmackTestSuite.init(); - } - @Test public void testScramSha1Mechanism() throws NotConnectedException, SmackException, InterruptedException { final DummyConnection con = new DummyConnection(); diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestSuite.java b/smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestSuite.java index a7d1144d1..c2a932070 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestSuite.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestSuite.java @@ -23,23 +23,14 @@ import net.iharder.Base64; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.stringencoder.Base64.Encoder; -import org.junit.runners.Suite; -import org.junit.runners.model.InitializationError; -import org.junit.runners.model.RunnerBuilder; /** * The SmackTestSuite takes care of initializing Smack for the unit tests. For example the Base64 * encoder is configured. */ -public class SmackTestSuite extends Suite { +public class SmackTestSuite { - public SmackTestSuite(Class klass, RunnerBuilder builder) throws InitializationError { - super(klass, builder); - - init(); - } - - public static void init() { + static { org.jivesoftware.smack.util.stringencoder.Base64.setEncoder(new Encoder() { @Override @@ -91,7 +82,6 @@ public class SmackTestSuite extends Suite { throw new AssertionError(e); } } - }); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java index 061bd38b9..04ffdf126 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java @@ -17,8 +17,9 @@ package org.jivesoftware.smackx; import org.jivesoftware.smack.extensions.ExtensionsInitializer; +import org.jivesoftware.smack.test.util.SmackTestSuite; -public class InitExtensions { +public class InitExtensions extends SmackTestSuite { static { (new ExtensionsInitializer()).initialize(); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java index 67a6a1ca6..e910ce829 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java @@ -23,6 +23,7 @@ import static org.mockito.Mockito.verify; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.XMPPError; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; import org.junit.Test; import org.jxmpp.jid.Jid; @@ -35,7 +36,7 @@ import org.powermock.reflect.Whitebox; * * @author Henning Staib */ -public class CloseListenerTest { +public class CloseListenerTest extends InitExtensions { static final Jid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE; static final Jid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java index 4f770d046..e11ffcdcb 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java @@ -23,6 +23,7 @@ import static org.mockito.Mockito.verify; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.XMPPError; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.packet.Data; import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension; import org.junit.Test; @@ -36,7 +37,7 @@ import org.powermock.reflect.Whitebox; * * @author Henning Staib */ -public class DataListenerTest { +public class DataListenerTest extends InitExtensions { static final Jid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE; static final Jid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBTestsSuite.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBTestsSuite.java deleted file mode 100644 index 2a58b0179..000000000 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBTestsSuite.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright the original author or authors - * - * 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.jivesoftware.smackx.bytestreams.ibb; - -import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.bytestreams.ibb.packet.CloseTest; -import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtensionTest; -import org.jivesoftware.smackx.bytestreams.ibb.packet.DataTest; -import org.jivesoftware.smackx.bytestreams.ibb.packet.OpenTest; -import org.jivesoftware.smackx.bytestreams.ibb.provider.OpenIQProviderTest; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(SmackTestSuite.class) -@Suite.SuiteClasses( { CloseTest.class, DataPacketExtensionTest.class, DataTest.class, - OpenTest.class, OpenIQProviderTest.class, CloseListenerTest.class, - DataListenerTest.class, InBandBytestreamManagerTest.class, - InBandBytestreamRequestTest.class, - InBandBytestreamSessionMessageTest.class, - InBandBytestreamSessionTest.class, InitiationListenerTest.class }) -public class IBBTestsSuite { - // the class remains completely empty, - // being used only as a holder for the above annotations -} diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java index f37cd3304..188c29be7 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java @@ -28,6 +28,7 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.XMPPError; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType; import org.jivesoftware.smackx.bytestreams.ibb.packet.Open; import org.jivesoftware.util.ConnectionUtils; @@ -44,7 +45,7 @@ import org.jxmpp.jid.JidTestUtil; * * @author Henning Staib */ -public class InBandBytestreamManagerTest { +public class InBandBytestreamManagerTest extends InitExtensions { // settings static final FullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java index 4a23695e7..d7e7afdfe 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java @@ -25,6 +25,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.XMPPError; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.packet.Open; import org.junit.Before; import org.junit.Test; @@ -37,7 +38,7 @@ import org.mockito.ArgumentCaptor; * * @author Henning Staib */ -public class InBandBytestreamRequestTest { +public class InBandBytestreamRequestTest extends InitExtensions { static final Jid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE; static final Jid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java index c622732fd..4ed6c5715 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java @@ -32,6 +32,7 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.util.stringencoder.Base64; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType; import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension; import org.jivesoftware.smackx.bytestreams.ibb.packet.Open; @@ -52,7 +53,7 @@ import org.powermock.reflect.Whitebox; * * @author Henning Staib */ -public class InBandBytestreamSessionMessageTest { +public class InBandBytestreamSessionMessageTest extends InitExtensions { // settings static final FullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java index b00046113..0a8eae3ba 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java @@ -32,6 +32,7 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.XMPPError; import org.jivesoftware.smack.util.stringencoder.Base64; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.packet.Data; import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension; import org.jivesoftware.smackx.bytestreams.ibb.packet.Open; @@ -53,7 +54,7 @@ import org.powermock.reflect.Whitebox; * * @author Henning Staib */ -public class InBandBytestreamSessionTest { +public class InBandBytestreamSessionTest extends InitExtensions { // settings static final FullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java index 7070b4de3..00d49361d 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.verify; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.XMPPError; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.BytestreamRequest; import org.jivesoftware.smackx.bytestreams.ibb.packet.Open; import org.junit.Before; @@ -39,7 +40,7 @@ import org.powermock.reflect.Whitebox; * * @author Henning Staib */ -public class InitiationListenerTest { +public class InitiationListenerTest extends InitExtensions { static final FullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE; static final FullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java index 713ab5667..a1e5b153f 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java @@ -22,6 +22,7 @@ import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import java.util.Properties; import org.jivesoftware.smack.packet.IQ; +import org.jivesoftware.smackx.InitExtensions; import org.junit.Test; import org.jxmpp.jid.impl.JidCreate; @@ -32,7 +33,7 @@ import com.jamesmurty.utils.XMLBuilder; * * @author Henning Staib */ -public class CloseTest { +public class CloseTest extends InitExtensions { @Test(expected = IllegalArgumentException.class) public void shouldNotInstantiateWithInvalidArguments1() { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java index cc10885af..435609026 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertNull; import java.util.Properties; +import org.jivesoftware.smackx.InitExtensions; import org.junit.Test; import com.jamesmurty.utils.XMLBuilder; @@ -31,7 +32,7 @@ import com.jamesmurty.utils.XMLBuilder; * * @author Henning Staib */ -public class DataPacketExtensionTest { +public class DataPacketExtensionTest extends InitExtensions { @Test(expected = IllegalArgumentException.class) public void shouldNotInstantiateWithInvalidArgument1() { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java index f714355fa..54c50f6fa 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java @@ -24,6 +24,7 @@ import java.util.Properties; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.util.stringencoder.Base64; +import org.jivesoftware.smackx.InitExtensions; import org.junit.Test; import org.jxmpp.jid.impl.JidCreate; @@ -34,7 +35,7 @@ import com.jamesmurty.utils.XMLBuilder; * * @author Henning Staib */ -public class DataTest { +public class DataTest extends InitExtensions { @Test(expected = IllegalArgumentException.class) public void shouldNotInstantiateWithInvalidArgument() { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java index 6da90fdaa..17099cb2a 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals; import java.util.Properties; import org.jivesoftware.smack.packet.IQ; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType; import org.junit.Test; import org.jxmpp.jid.impl.JidCreate; @@ -33,7 +34,7 @@ import com.jamesmurty.utils.XMLBuilder; * * @author Henning Staib */ -public class OpenTest { +public class OpenTest extends InitExtensions { @Test(expected = IllegalArgumentException.class) public void shouldNotInstantiateWithInvalidArguments1() { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java index befea52eb..1ef40f6bd 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.StringReader; import java.util.Properties; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType; import org.jivesoftware.smackx.bytestreams.ibb.packet.Open; import org.junit.Test; @@ -36,7 +37,7 @@ import com.jamesmurty.utils.XMLBuilder; * * @author Henning Staib */ -public class OpenIQProviderTest { +public class OpenIQProviderTest extends InitExtensions { private static Properties outputProperties = new Properties(); { @@ -73,7 +74,7 @@ public class OpenIQProviderTest { assertEquals(StanzaType.MESSAGE, open.getStanza()); } - private XmlPullParser getParser(String control) throws XmlPullParserException, + private static XmlPullParser getParser(String control) throws XmlPullParserException, IOException { XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser(); parser.setInput(new StringReader(control)); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java index b60956da6..5b94685e0 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java @@ -26,7 +26,6 @@ import java.util.Collection; import java.util.LinkedList; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.stringencoder.Base32; import org.jivesoftware.smack.util.stringencoder.StringEncoder; @@ -36,7 +35,6 @@ import org.jivesoftware.smackx.caps.cache.SimpleDirectoryPersistentCache; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.packet.DataForm; -import org.junit.Before; import org.junit.Test; import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.stringprep.XmppStringprepException; @@ -44,11 +42,6 @@ import org.jxmpp.stringprep.XmppStringprepException; public class EntityCapsManagerTest extends InitExtensions { - @Before - public void initSmackTestSuite() { - SmackTestSuite.init(); - } - /** * XEP- * 0115 Complex Generation Example @@ -80,7 +73,7 @@ public class EntityCapsManagerTest extends InitExtensions { assertTrue(di.containsDuplicateIdentities()); } - private void testSimpleDirectoryCache(StringEncoder stringEncoder) throws IOException { + private static void testSimpleDirectoryCache(StringEncoder stringEncoder) throws IOException { EntityCapsPersistentCache cache = new SimpleDirectoryPersistentCache(createTempDirectory()); EntityCapsManager.setPersistentCache(cache); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java index 2855994ee..d1a31a37b 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java @@ -25,10 +25,11 @@ import org.jivesoftware.smack.DummyConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.util.PacketParserUtils; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.iqversion.packet.Version; import org.junit.Test; -public class VersionTest { +public class VersionTest extends InitExtensions { @Test public void checkProvider() throws Exception { // @formatter:off diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java index b35feb25d..8ffe06e36 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java @@ -33,21 +33,14 @@ import org.jivesoftware.smack.ThreadedDummyConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.ping.packet.Ping; -import org.junit.Before; import org.junit.Test; public class PingTest extends InitExtensions { - @Before - public void initSmackTestSuite() { - SmackTestSuite.init(); - } - @Test public void checkProvider() throws Exception { // @formatter:off diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/vcardtemp/VCardTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/vcardtemp/VCardTest.java index 419762896..68824fef4 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/vcardtemp/VCardTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/vcardtemp/VCardTest.java @@ -21,21 +21,14 @@ import static org.junit.Assert.assertTrue; import java.util.Arrays; -import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.stringencoder.Base64; import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.vcardtemp.packet.VCard; -import org.junit.Before; import org.junit.Test; public class VCardTest extends InitExtensions { - @Before - public void initSmackTestSuite() { - SmackTestSuite.init(); - } - @Test public void testParseFullVCardIQStanza() throws Throwable { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java index a49b665d0..fe52247e6 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java @@ -22,7 +22,6 @@ import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.io.InputStreamReader; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.provider.DataFormProvider; @@ -73,7 +72,7 @@ public class DataLayoutTest { } @Test - public void testLayoutSpecialCharacters() throws XmlPullParserException, IOException, SmackException { + public void testLayoutSpecialCharacters() throws XmlPullParserException, IOException { DataLayout layout = new DataLayout("Label - & \u00E9 \u00E1 "); Fieldref reffield = new Fieldref("testField1"); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java index 188f26b70..9e91c0a30 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java @@ -16,13 +16,12 @@ */ package org.jivesoftware.smackx.xdatavalidation.provider; -import static org.junit.Assert.assertEquals; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.test.util.TestUtils; import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement; import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.BasicValidateElement; @@ -45,7 +44,7 @@ public class DataValidationTest { private static final String TEST_OUTPUT_FAIL = ""; @Test - public void testMin() throws XmlPullParserException, IOException, SmackException { + public void testMin() throws XmlPullParserException, IOException { ValidateElement dv = new BasicValidateElement(null); @@ -67,7 +66,7 @@ public class DataValidationTest { } @Test - public void testRange() throws XmlPullParserException, IOException, SmackException { + public void testRange() throws XmlPullParserException, IOException { ValidateElement dv = new RangeValidateElement("xs:string", "min-val", "max-val"); @@ -99,7 +98,7 @@ public class DataValidationTest { } @Test - public void testRange2() throws XmlPullParserException, IOException, SmackException { + public void testRange2() throws XmlPullParserException, IOException { ValidateElement dv = new RangeValidateElement(null, null, null); @@ -124,7 +123,7 @@ public class DataValidationTest { } @Test(expected=NumberFormatException.class) - public void testRangeFailure() throws IOException, SmackException, XmlPullParserException { + public void testRangeFailure() throws IOException, XmlPullParserException { XmlPullParser parser = getParser(TEST_OUTPUT_FAIL); DataValidationProvider.parse(parser); } @@ -135,7 +134,7 @@ public class DataValidationTest { * @throws XmlPullParserException * @throws IOException */ - private XmlPullParser getParser(String output) throws XmlPullParserException, IOException { + private static XmlPullParser getParser(String output) throws XmlPullParserException, IOException { return TestUtils.getParser(output, "validate"); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java index 3fd25cd36..d6388ecc0 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java @@ -48,7 +48,7 @@ public class XHTMLExtensionProviderTest { assertThat(sampleXhtml(), equalsCharSequence(attachmentsInfo.getBodies().get(0))); } - private String sampleXhtml() { + private static String sampleXhtml() { return "" + "