mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-26 06:07:59 +01:00
Return empty map in SpoilerElement.getSpoilers() instead of null
This commit is contained in:
parent
4292659f22
commit
bde6239c26
2 changed files with 3 additions and 2 deletions
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.spoiler.element;
|
|||
|
||||
import static org.jivesoftware.smackx.spoiler.SpoilerManager.NAMESPACE_0;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -110,7 +111,7 @@ public class SpoilerElement implements ExtensionElement {
|
|||
*/
|
||||
public static Map<String, String> getSpoilers(Message message) {
|
||||
if (!containsSpoiler(message)) {
|
||||
return null;
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
List<ExtensionElement> spoilers = message.getExtensions(SpoilerElement.ELEMENT, NAMESPACE_0);
|
||||
|
|
|
@ -97,7 +97,7 @@ public class SpoilerTest extends SmackTestSuite {
|
|||
@Test
|
||||
public void getSpoilersTest() {
|
||||
Message m = new Message();
|
||||
assertNull(SpoilerElement.getSpoilers(m));
|
||||
assertTrue(SpoilerElement.getSpoilers(m).isEmpty());
|
||||
|
||||
SpoilerElement.addSpoiler(m);
|
||||
assertTrue(SpoilerElement.containsSpoiler(m));
|
||||
|
|
Loading…
Reference in a new issue