From 8bec182d2aba170cf658bb610d03c7072f755310 Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Fri, 15 May 2020 11:53:31 +0200 Subject: [PATCH] Additional Pubsub integration tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test for XEP-0060 § 8.4.3.2: Asserts that the server returns an 'item-not-found' error response when deleting a node that does not exist. --- .../smackx/pubsub/PubSubIntegrationTest.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java index 533099033..03cb5ebe8 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java @@ -922,5 +922,27 @@ public class PubSubIntegrationTest extends AbstractSmackIntegrationTest { } } - + /** + * Asserts that the server returns an 'item-not-found' error response when + * deleting a node that does not exist. + * + *

+ * From XEP-0060 § 8.4.3.2: + *

+ *
If the requesting entity attempts to delete a node that does not + * exist, the service MUST return an <item-not-found/> error. + *
+ * + * @throws NoResponseException if there was no response from the remote + * entity. + * @throws XMPPErrorException if there was an XMPP error returned. + * @throws NotConnectedException if the XMPP connection is not connected. + * @throws InterruptedException if the calling thread was interrupted. + */ + @SmackIntegrationTest + public void deleteNonExistentNodeTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { + final String nodename = "sinttest-delete-node-that-does-not-exist-" + testRunId; + // Delete an non existent node + assertFalse( pubSubManagerOne.deleteNode(nodename), "The server should have returned a error, but did not." ); + } }