@@ -0,0 +1,2047 @@
+/**%0A *%0A * Copyright 2018 Florian Schmaus%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.jivesoftware.smackx.commands.provider;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport org.jivesoftware.smack.packet.IQ;%0Aimport org.jivesoftware.smack.packet.Stanza;%0Aimport org.jivesoftware.smack.packet.StanzaError;%0Aimport org.jivesoftware.smack.util.PacketParserUtils;%0A%0Aimport org.jivesoftware.smackx.commands.AdHocCommand;%0Aimport org.jivesoftware.smackx.commands.packet.AdHocCommandData;%0A%0Aimport org.junit.Test;%0A%0Apublic class CommandsProviderTest %7B%0A%0A    @Test%0A    public void parseErrorWithRequest() throws Exception %7B%0A        final String errorWithRequest = %22%3Ciq id='sid' type='error' from='from@example.com' to='to@example.com'%3E%22%0A                        + %22%3Ccommand xmlns='http://jabber.org/protocol/commands' node='http://example.com' action='execute'%3E%22%0A                        + %22%3C/command%3E%22 + %22%3Cerror type='cancel'%3E%22%0A                        + %22%3Cbad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/%3E%22 + %22%3C/error%3E%22 + %22%3C/iq%3E%22;%0A%0A        final Stanza requestStanza = PacketParserUtils.parseStanza(errorWithRequest);%0A        final AdHocCommandData adHocIq = (AdHocCommandData) requestStanza;%0A%0A        assertEquals(IQ.Type.error, adHocIq.getType());%0A        assertEquals(AdHocCommand.Action.execute, adHocIq.getAction());%0A%0A        StanzaError error = adHocIq.getError();%0A        assertEquals(StanzaError.Type.CANCEL, error.getType());%0A        assertEquals(StanzaError.Condition.bad_request, error.getCondition());%0A    %7D%0A%7D%0A

Add CommandsProviderTest