From 4519699dfaa41b1c6e8d01266a7e437754b869f5 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Sun, 31 Oct 2004 03:37:05 +0000 Subject: [PATCH] Added test that ensures that Smack answers a 404 error when the disco#info includes a node. SMACK-8 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2403 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/ServiceDiscoveryManagerTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java b/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java index 9fcc81e12..2766925e8 100644 --- a/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java +++ b/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java @@ -55,6 +55,7 @@ package org.jivesoftware.smackx; import java.util.Iterator; import org.jivesoftware.smack.SmackConfiguration; +import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.test.SmackTestCase; import org.jivesoftware.smackx.packet.DiscoverInfo; import org.jivesoftware.smackx.packet.DiscoverItems; @@ -102,6 +103,28 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase { } } + /** + * Tests that ensures that Smack answers a 404 error when the disco#info includes a node. + */ + public void testInfoWithNode() { + + ServiceDiscoveryManager discoManager = ServiceDiscoveryManager + .getInstanceFor(getConnection(0)); + try { + // Discover the information of another Smack client + discoManager.discoverInfo(getFullJID(1), "some node"); + // Check the identity of the Smack client + fail("Unexpected identities were returned instead of a 404 error"); + } + catch (XMPPException e) { + assertEquals("Incorrect error", 404, e.getXMPPError().getCode()); + } + catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + /** * Tests service discovery of XHTML support. */