mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-29 07:22:07 +01:00
Remove TODO:method should not throw any exception but currently does
`mgr.getNode(...)` method is not supposed to throw any type of exception. It threw two kinds of exceptions: `NotConnectedException` and `SmackException`. By using `ThreadedDummyConnection.newInstance()` method, `NotConnectedException` can be removed. And `SmackException` can be removed by correctly building the DiscoverInfo packet.
This commit is contained in:
parent
321c91c264
commit
afa42a8b41
1 changed files with 11 additions and 9 deletions
|
@ -79,23 +79,25 @@ public class ConfigureFormTest extends SmackTestSuite {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getConfigFormWithTimeout() throws XMPPException, InterruptedException {
|
||||
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||
public void getConfigFormWithTimeout() throws XMPPException, InterruptedException, SmackException, IOException {
|
||||
ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
|
||||
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
DiscoverInfoBuilder info = DiscoverInfo.builder("disco-result");
|
||||
DiscoverInfoBuilder info = DiscoverInfo.builder("disco-result")
|
||||
.ofType(IQ.Type.result)
|
||||
.from(PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
|
||||
Identity ident = new Identity("pubsub", null, "leaf");
|
||||
info.addIdentity(ident);
|
||||
|
||||
DiscoverInfo discoverInfo = info.build();
|
||||
con.addIQReply(discoverInfo);
|
||||
|
||||
assertThrows(SmackException.class, () -> {
|
||||
// TODO: This method should not throw any exception but currently does.
|
||||
Node node = mgr.getNode("princely_musings");
|
||||
|
||||
SmackConfiguration.setDefaultReplyTimeout(100);
|
||||
con.setTimeout();
|
||||
|
||||
assertThrows(SmackException.class, () -> {
|
||||
node.getNodeConfiguration();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue