1 package org.oxerr.okcoin.rest.dto; 2 3 import static org.junit.Assert.assertEquals; 4 5 import java.io.IOException; 6 import java.math.BigDecimal; 7 8 import org.junit.Test; 9 import org.oxerr.okcoin.rest.dto.Depth; 10 11 import com.fasterxml.jackson.core.JsonParseException; 12 import com.fasterxml.jackson.databind.JsonMappingException; 13 14 public class DepthTest extends UnmarshalTest { 15 16 @Test 17 public void test() throws JsonParseException, JsonMappingException, 18 IOException { 19 Depth depth = readValue("depth.json", Depth.class); 20 21 assertEquals(5, depth.getAsks().length); 22 23 assertEquals(new BigDecimal("792"), depth.getAsks()[0][0]); 24 assertEquals(new BigDecimal("5"), depth.getAsks()[0][1]); 25 26 assertEquals(new BigDecimal("789.68"), depth.getAsks()[1][0]); 27 assertEquals(new BigDecimal("0.018"), depth.getAsks()[1][1]); 28 29 assertEquals(new BigDecimal("788.99"), depth.getAsks()[2][0]); 30 assertEquals(new BigDecimal("0.042"), depth.getAsks()[2][1]); 31 32 assertEquals(new BigDecimal("788.43"), depth.getAsks()[3][0]); 33 assertEquals(new BigDecimal("0.036"), depth.getAsks()[3][1]); 34 35 assertEquals(new BigDecimal("787.27"), depth.getAsks()[4][0]); 36 assertEquals(new BigDecimal("0.02"), depth.getAsks()[4][1]); 37 38 assertEquals(7, depth.getBids().length); 39 40 assertEquals(new BigDecimal("787.1"), depth.getBids()[0][0]); 41 assertEquals(new BigDecimal("0.35"), depth.getBids()[0][1]); 42 43 assertEquals(new BigDecimal("787"), depth.getBids()[1][0]); 44 assertEquals(new BigDecimal("12.071"), depth.getBids()[1][1]); 45 46 assertEquals(new BigDecimal("786.5"), depth.getBids()[2][0]); 47 assertEquals(new BigDecimal("0.014"), depth.getBids()[2][1]); 48 49 assertEquals(new BigDecimal("786.2"), depth.getBids()[3][0]); 50 assertEquals(new BigDecimal("0.38"), depth.getBids()[3][1]); 51 52 assertEquals(new BigDecimal("786"), depth.getBids()[4][0]); 53 assertEquals(new BigDecimal("3.217"), depth.getBids()[4][1]); 54 55 assertEquals(new BigDecimal("785.3"), depth.getBids()[5][0]); 56 assertEquals(new BigDecimal("5.322"), depth.getBids()[5][1]); 57 58 assertEquals(new BigDecimal("785.04"), depth.getBids()[6][0]); 59 assertEquals(new BigDecimal("5.04"), depth.getBids()[6][1]); 60 } 61 62 }