summaryrefslogtreecommitdiffstats
blob: 50ee1882da583af301b1417ef8a470d58492bee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (c) 2015 Tarun Gupta.
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

package com.isode.stroke.serializer.payloadserializers;

import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
import com.isode.stroke.elements.ChatState;
import com.isode.stroke.serializer.payloadserializers.ChatStateSerializer;

public class ChatStateSerializerTest {

	ChatStateSerializer testling = new ChatStateSerializer();

	@Test
	public void testSerialize_ActiveState() {
		ChatState priority = new ChatState(ChatState.ChatStateType.Active);
		String expected = "<active xmlns=\"http://jabber.org/protocol/chatstates\"/>";
		assertEquals(expected, testling.serialize(priority));	
	}

	@Test
	public void testSerialize_GoneState() {
		ChatState priority = new ChatState(ChatState.ChatStateType.Gone);
		String expected = "<gone xmlns=\"http://jabber.org/protocol/chatstates\"/>";
		assertEquals(expected, testling.serialize(priority));
	}

	@Test
	public void testSerialize_ComposingState() {
		ChatState priority = new ChatState(ChatState.ChatStateType.Composing);
		String expected = "<composing xmlns=\"http://jabber.org/protocol/chatstates\"/>";
		assertEquals(expected, testling.serialize(priority));
	}

	@Test
	public void testSerialize_PausedState() {
		ChatState priority = new ChatState(ChatState.ChatStateType.Paused);
		String expected = "<paused xmlns=\"http://jabber.org/protocol/chatstates\"/>";
		assertEquals(expected, testling.serialize(priority));
	}

	@Test
	public void testSerialize_InactiveState() {
		ChatState priority = new ChatState(ChatState.ChatStateType.Inactive);
		String expected = "<inactive xmlns=\"http://jabber.org/protocol/chatstates\"/>";
		assertEquals(expected, testling.serialize(priority));
	}
}