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.
|
|
|
|
*/
|
2015-01-22 13:53:50 +01:00
|
|
|
package org.jivesoftware.smack.roster;
|
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
|
|
|
|
2015-01-22 13:53:50 +01:00
|
|
|
import org.jivesoftware.smack.DummyConnection;
|
2014-05-15 15:04:46 +02:00
|
|
|
import org.jivesoftware.smack.SmackException;
|
2017-06-14 17:12:43 +02:00
|
|
|
|
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.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2010-08-15 18:32:09 +02:00
|
|
|
* @author Henning Staib
|
|
|
|
*/
|
|
|
|
public class RosterOfflineTest {
|
|
|
|
|
2017-12-13 23:10:11 +01:00
|
|
|
private DummyConnection connection;
|
2010-08-15 18:32:09 +02:00
|
|
|
|
2017-12-13 23:10:11 +01:00
|
|
|
private Roster roster;
|
2010-08-15 18:32:09 +02:00
|
|
|
|
|
|
|
@Before
|
2015-03-24 18:33:47 +01:00
|
|
|
public void setup() {
|
2015-01-22 13:53:50 +01:00
|
|
|
this.connection = new DummyConnection();
|
2010-08-15 18:32:09 +02:00
|
|
|
assertFalse(connection.isConnected());
|
|
|
|
|
2015-01-22 13:53:50 +01:00
|
|
|
roster = Roster.getInstanceFor(connection);
|
2010-08-15 18:32:09 +02:00
|
|
|
assertNotNull(roster);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|