summaryrefslogtreecommitdiff
path: root/src/test/java/com/p4square/ccbapi/model/GetCustomFieldLabelsResponseTest.java
blob: 549b8e901e3bbcc0482d54d38210724863207652 (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
package com.p4square.ccbapi.model;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Tests for parsing GetCustomFieldLabelsResponse.
 */
public class GetCustomFieldLabelsResponseTest extends XmlBinderTestBase {

    /**
     * Assert that all of the fields bind appropriately in a GetCustomFieldLabelsResponse.
     */
    @Test
    public void testGetCustomFieldLabelsResponse() throws Exception {
        final GetCustomFieldLabelsResponse response = parseFile("ccb_custom_labels_response.xml",
                GetCustomFieldLabelsResponse.class);

        assertNull("Response should not have errors", response.getErrors());

        assertNotNull(response.getCustomFields());
        assertEquals(27, response.getCustomFields().size());

        // Check the first field.
        CustomField field = response.getCustomFields().get(0);
        assertEquals("udf_ind_text_1", field.getName());
        assertEquals("Favorite Movie", field.getLabel());
        assertEquals(false, field.isAdminOnly());

        // And the second.
        field = response.getCustomFields().get(1);
        assertEquals("udf_ind_text_2", field.getName());
        assertEquals("Another Field", field.getLabel());
        assertEquals(true, field.isAdminOnly());

        // And that's probably enough for now...
    }
}