Last active
October 14, 2019 12:51
-
-
Save leonardocregis/4d973a20caec78c3f3ee9a46fbd781c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import java.io.IOException; | |
| import org.junit.Test; | |
| import static org.junit.Assert.assertNotNull; | |
| public class ResponseTest { | |
| @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; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment