forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplayFormTest.java
More file actions
43 lines (33 loc) · 1.56 KB
/
Copy pathDisplayFormTest.java
File metadata and controls
43 lines (33 loc) · 1.56 KB
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
/*
* Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved.
*/
package com.gooddata.md;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import java.io.InputStream;
import static com.gooddata.JsonMatchers.serializesToJson;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
public class DisplayFormTest {
public static final String FORM_OF = "/gdc/md/PROJECT_ID/obj/DF_FORM_OF_ID";
public static final String EXPRESSION = "[/gdc/md/PROJECT_ID/obj/DF_EXPRESSION_ID]";
public static final Integer DEFAULT = 0;
public static final String LDM_EXPRESSION = "";
@Test
public void shouldDeserialize() throws Exception {
final InputStream stream = getClass().getResourceAsStream("/md/displayForm.json");
final DisplayForm displayForm = new ObjectMapper().readValue(stream, DisplayForm.class);
assertThat(displayForm, is(notNullValue()));
assertThat(displayForm.getFormOf(), is(FORM_OF));
assertThat(displayForm.getExpression(), is(EXPRESSION));
assertThat(displayForm.getDefault(), is(DEFAULT));
assertThat(displayForm.getLdmExpression(), is(LDM_EXPRESSION));
}
@Test
public void testSerialization() throws Exception {
final DisplayForm displayForm = new DisplayForm(new Meta("Person Name"),
new DisplayForm.Content(FORM_OF, EXPRESSION, DEFAULT, LDM_EXPRESSION));
assertThat(displayForm, serializesToJson("/md/displayForm-input.json"));
}
}