mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
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.
This commit is contained in:
parent
c6594aec2f
commit
0897b76718
24 changed files with 44 additions and 107 deletions
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue