Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.fasterxml.jackson.databind.ObjectMapper;
- import java.io.IOException;
- import org.junit.Test;
- import static org.junit.Assert.assertNotNull;
- public class TT080DgiiOrderResponseTest {
- @Test
- public void testParseJson() throws IOException {
- String jsonData = "{\n" +
- " \"total\": 100," +
- " \"val\": 2000," +
- "}";
- ObjectMapper objectMapper = new ObjectMapper();
- TT080DgiiOrderResponse response = objectMapper.readValue(jsonData, JsonMapped.class);
- assertNotNull(response);
- }
- }
- .....
- import com.fasterxml.jackson.annotation.JsonProperty;
- public class JsonMapped {
- @JsonProperty("total")
- private Long total
- @JsonProperty("val")
- private Long value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement