1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-24 12:24:51 +02:00
Smack/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/RosterOfflineTest.java
Florian Schmaus c81cd34561 Apply builder pattern to ConnectionConfiguration
Introducing a clean split between the constant connection configuration
parameters, which are now all in ConnectionConfiguration and the dynamic
connection state (e.g. hostAddresses) which are now in
AbstractXMPPConnection.

Also removed all arguments of login() since the username, password,
resource and callback handler need now to be configured via
ConnectionConfiguration.

Also remove documentation/extensions/messageevents.md, as it's already
in documentation/legacy
2014-11-15 09:46:31 +01:00

64 lines
1.8 KiB
Java

/**
*
* 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.smack.tcp;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.junit.Before;
import org.junit.Test;
/**
* Tests the behavior of the roster if the connection is not authenticated yet.
*
* @author Henning Staib
*/
public class RosterOfflineTest {
XMPPTCPConnection connection;
Roster roster;
@Before
public void setup() throws XMPPException, SmackException {
this.connection = new XMPPTCPConnection("user", "pass", "example.org");
assertFalse(connection.isConnected());
roster = connection.getRoster();
assertNotNull(roster);
}
@Test(expected = SmackException.class)
public void shouldThrowExceptionOnCreateEntry() throws Exception {
roster.createEntry("test", "test", null);
}
@Test(expected = SmackException.class)
public void shouldThrowExceptionOnReload() throws Exception {
roster.reload();
}
@Test(expected = SmackException.class)
public void shouldThrowExceptionRemoveEntry() throws Exception {
roster.removeEntry(null);
}
}