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
10 import com.fasterxml.jackson.core.JsonParseException;
11 import com.fasterxml.jackson.databind.JsonMappingException;
12
13
14
15
16 public class TradesTest extends UnmarshalTest {
17
18 @Test
19 public void test() throws JsonParseException, JsonMappingException,
20 IOException {
21 Trade[] trades = readValue("trades.json", Trade[].class);
22 assertEquals(4, trades.length);
23
24 assertEquals(1367130137000L, trades[0].getDate().toEpochMilli());
25 assertEquals(new BigDecimal("787.71"), trades[0].getPrice());
26 assertEquals(new BigDecimal("0.003"), trades[0].getAmount());
27 assertEquals(230433, trades[0].getTid());
28 assertEquals(Type.SELL, trades[0].getType());
29
30 assertEquals(1367130137000L, trades[1].getDate().toEpochMilli());
31 assertEquals(new BigDecimal("787.65"), trades[1].getPrice());
32 assertEquals(new BigDecimal("0.001"), trades[1].getAmount());
33 assertEquals(230434, trades[1].getTid());
34 assertEquals(Type.SELL, trades[1].getType());
35
36 assertEquals(1367130137000L, trades[2].getDate().toEpochMilli());
37 assertEquals(new BigDecimal("787.5"), trades[2].getPrice());
38 assertEquals(new BigDecimal("0.091"), trades[2].getAmount());
39 assertEquals(230435, trades[2].getTid());
40 assertEquals(Type.SELL, trades[2].getType());
41
42 assertEquals(1367131526000L, trades[3].getDate().toEpochMilli());
43 assertEquals(new BigDecimal("787.27"), trades[3].getPrice());
44 assertEquals(new BigDecimal("0.03"), trades[3].getAmount());
45 assertEquals(230512, trades[3].getTid());
46 assertEquals(Type.BUY, trades[3].getType());
47 }
48
49 }