mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Smack 4.2.4
-----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlrTPy5fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF IFI5aAf/Rb6Y+hqxiHRbsmww74rt7HfgQnOjOjz3bPhgbVH2emzBHzxsU2pBBY87 iTfCXjXA3qQ9FzluBchLrd9EciDEXq1A/ZblYnR+kch1DK7wvVipTPWIzOHt6ahD q7vfS9EmmFBCRjNM4tW8zwaajWWeJAWimXoZFxuy/n+2FORnx0x5NrnIHwYvyUtf nY432BOiCg7l6J9sgfcoYDgP0Ot4SkdfUIgGOYonv0lzKW8HkU/OZZwEMbFhlCHU s0inbU5ldDDP7xXIinDqHVSKpRlSIkaOJ0zbAQLjFz8h2fCnqDGhpnNbun8Xb7l2 agsATloOl91tlUV5D+qRWjzkx7pDxA== =YqLS -----END PGP SIGNATURE----- Merge tag '4.2.4' Smack 4.2.4
This commit is contained in:
commit
74f14484e6
13 changed files with 311 additions and 7 deletions
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2018 Paul Schaub
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* 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.
|
||||
*/
|
||||
package org.jivesoftware.smackx.last_interaction;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.TestUtils;
|
||||
import org.jivesoftware.smackx.last_interaction.element.IdleElement;
|
||||
import org.jivesoftware.smackx.last_interaction.provider.IdleProvider;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.jxmpp.util.XmppDateTime;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
public class IdleTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void providerTest() throws Exception {
|
||||
String xml = "<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15Z' />";
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
assertNotNull(parser);
|
||||
IdleElement parsed = IdleProvider.TEST_INSTANCE.parse(parser);
|
||||
Date date = XmppDateTime.parseXEP0082Date("1969-07-21T02:56:15Z");
|
||||
assertEquals(date, parsed.getSince());
|
||||
|
||||
IdleElement element = new IdleElement(date);
|
||||
assertXMLEqual("<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15.000+00:00'/>", element.toXML().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void helperTest() {
|
||||
Presence presence = new Presence(Presence.Type.available);
|
||||
IdleElement.addToPresence(presence);
|
||||
IdleElement element = IdleElement.fromPresence(presence);
|
||||
assertNotNull(element);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue