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.
|
|
|
|
*/
|
2010-08-15 18:32:09 +02:00
|
|
|
package org.jivesoftware.smack;
|
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
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-03-10 09:45:50 +01:00
|
|
|
XMPPConnection 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-04-09 12:16:44 +02:00
|
|
|
this.connection = new XMPPTCPConnection("localhost");
|
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 shouldThrowExceptionOnCreateGroup() throws Exception {
|
|
|
|
roster.createGroup("test");
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|