2013-02-07 15:19:47 +01:00
|
|
|
/**
|
|
|
|
*
|
2014-02-17 18:57:38 +01:00
|
|
|
* Copyright the original author or authors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
2013-02-07 15:19:47 +01:00
|
|
|
* 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.
|
|
|
|
*/
|
2014-05-15 15:04:46 +02:00
|
|
|
package org.jivesoftware.smack.tcp;
|
2010-08-15 18:32:09 +02:00
|
|
|
|
2014-08-15 23:16:18 +02:00
|
|
|
import static org.junit.Assert.assertFalse;
|
|
|
|
import static org.junit.Assert.assertNotNull;
|
2010-08-15 18:32:09 +02:00
|
|
|
|
2014-05-15 15:04:46 +02:00
|
|
|
import org.jivesoftware.smack.Roster;
|
|
|
|
import org.jivesoftware.smack.SmackException;
|
|
|
|
import org.jivesoftware.smack.XMPPException;
|
2010-08-15 18:32:09 +02:00
|
|
|
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 {
|
|
|
|
|
2014-05-25 12:28:08 +02:00
|
|
|
XMPPTCPConnection connection;
|
2010-08-15 18:32:09 +02:00
|
|
|
|
|
|
|
Roster roster;
|
|
|
|
|
|
|
|
@Before
|
2014-03-12 11:50:05 +01:00
|
|
|
public void setup() throws XMPPException, SmackException {
|
2014-11-09 18:30:16 +01:00
|
|
|
this.connection = new XMPPTCPConnection("user", "pass", "example.org");
|
2010-08-15 18:32:09 +02:00
|
|
|
assertFalse(connection.isConnected());
|
|
|
|
|
|
|
|
roster = connection.getRoster();
|
|
|
|
assertNotNull(roster);
|
|
|
|
}
|
|
|
|
|
2014-03-12 11:50:05 +01:00
|
|
|
@Test(expected = SmackException.class)
|
2010-08-15 18:32:09 +02:00
|
|
|
public void shouldThrowExceptionOnCreateEntry() throws Exception {
|
|
|
|
roster.createEntry("test", "test", null);
|
|
|
|
}
|
|
|
|
|
2014-03-12 11:50:05 +01:00
|
|
|
@Test(expected = SmackException.class)
|
2010-08-15 18:32:09 +02:00
|
|
|
public void shouldThrowExceptionOnReload() throws Exception {
|
|
|
|
roster.reload();
|
|
|
|
}
|
|
|
|
|
2014-03-12 11:50:05 +01:00
|
|
|
@Test(expected = SmackException.class)
|
2010-08-15 18:32:09 +02:00
|
|
|
public void shouldThrowExceptionRemoveEntry() throws Exception {
|
|
|
|
roster.removeEntry(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|