forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetricTest.java
More file actions
30 lines (24 loc) · 1.03 KB
/
Copy pathMetricTest.java
File metadata and controls
30 lines (24 loc) · 1.03 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
/*
* Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved.
*/
package com.gooddata.md;
import org.codehaus.jackson.map.ObjectMapper;
import org.testng.annotations.Test;
import static com.gooddata.JsonMatchers.serializesToJson;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
public class MetricTest {
@Test
public void testDeserialization() throws Exception {
final Metric metric = new ObjectMapper().readValue(getClass().getResourceAsStream("/md/metric.json"), Metric.class);
assertThat(metric, is(notNullValue()));
assertThat(metric.getExpression(), is("[/gdc/md/PROJECT_ID/obj/EXPR_ID]"));
assertThat(metric.getFormat(), is("FORMAT"));
}
@Test
public void testSerialization() throws Exception {
final Metric metric = new Metric("Person Name", "[/gdc/md/PROJECT_ID/obj/EXPR_ID]", "FORMAT");
assertThat(metric, serializesToJson("/md/metric-input.json"));
}
}