1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

sinttest: convert LoginIntegrationTest to Junit5

This commit is contained in:
Florian Schmaus 2020-04-11 12:18:18 +02:00
parent adfca965b5
commit 594d2f5238

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smack; package org.jivesoftware.smack;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.fail; import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException; import java.io.IOException;
import java.security.KeyManagementException; import java.security.KeyManagementException;
@ -25,6 +25,7 @@ import java.security.NoSuchAlgorithmException;
import org.jivesoftware.smack.sasl.SASLError; import org.jivesoftware.smack.sasl.SASLError;
import org.jivesoftware.smack.sasl.SASLErrorException; import org.jivesoftware.smack.sasl.SASLErrorException;
import org.jivesoftware.smack.sasl.packet.SaslNonza;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
@ -57,13 +58,11 @@ public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
AbstractXMPPConnection connection = getUnconnectedConnection(); AbstractXMPPConnection connection = getUnconnectedConnection();
connection.connect(); connection.connect();
try { SASLErrorException saslErrorException = assertThrows(SASLErrorException.class,
connection.login(nonExistentUserString, invalidPassword); () -> connection.login(nonExistentUserString, invalidPassword));
fail("Exception expected");
} SaslNonza.SASLFailure saslFailure = saslErrorException.getSASLFailure();
catch (SASLErrorException e) { assertEquals(SASLError.not_authorized, saslFailure.getSASLError());
assertEquals(SASLError.not_authorized, e.getSASLFailure().getSASLError());
}
} }
} }