forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGdcErrorTest.java
More file actions
36 lines (29 loc) · 1.29 KB
/
Copy pathGdcErrorTest.java
File metadata and controls
36 lines (29 loc) · 1.29 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
/*
* Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved.
*/
package com.gooddata.gdc;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.testng.annotations.Test;
import java.io.InputStream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
public class GdcErrorTest {
@Test
public void testDeserialization() throws Exception {
final InputStream inputStream = getClass().getResourceAsStream("/gdc/gdcError.json");
final GdcError err = new ObjectMapper().readValue(inputStream, GdcError.class);
assertThat(err, is(notNullValue()));
assertThat(err.getErrorClass(), is("CLASS"));
assertThat(err.getTrace(), is("TRACE"));
assertThat(err.getMessage(), is("MSG"));
assertThat(err.getComponent(), is("COMPONENT"));
assertThat(err.getErrorId(), is("ID"));
assertThat(err.getErrorCode(), is("CODE"));
assertThat(err.getRequestId(), is("REQ"));
assertThat(err.getParameters(), is(notNullValue()));
assertThat(err.getParameters().length, is(2));
assertThat(err.getParameters()[0].toString(), is("PARAM1"));
assertThat(err.getParameters()[1].toString(), is("PARAM2"));
}
}