blob: 1d37c867d3359e4e869f41f3a34c80bc0472e07b (
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
54
55
56
57
58
59
|
/*
* Copyright (c) 2012 Isode Limited, London, England.
* All rights reserved.
*/
/*
* Copyright (c) 2010 Remko Tronçon
* All rights reserved.
*/
package com.isode.stroke.elements;
import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
import com.isode.stroke.elements.FormField.FixedFormField;
import com.isode.stroke.elements.FormField.HiddenFormField;
public class FormTest {
@BeforeClass
public static void init() throws Exception {
}
@Test
public void testGetFormType() {
Form form = new Form();
form.addField(FixedFormField.create("Foo"));
FormField field = HiddenFormField.create("jabber:bot");
field.setName("FORM_TYPE");
form.addField(field);
form.addField(FixedFormField.create("Bar"));
assertEquals("jabber:bot", form.getFormType());
}
@Test
public void testGetFormType_InvalidFormType() {
Form form = new Form();
FormField field = FixedFormField.create("jabber:bot");
field.setName("FORM_TYPE");
form.addField(field);
assertEquals("", form.getFormType());
}
@Test
public void testGetFormType_NoFormType() {
Form form = new Form();
form.addField(FixedFormField.create("Foo"));
assertEquals("", form.getFormType());
}
}
|