Package com.xeiam.xchange.campbx.dto

Source Code of com.xeiam.xchange.campbx.dto.MyOrdersJSONTest

package com.xeiam.xchange.campbx.dto;

import static org.fest.assertions.api.Assertions.assertThat;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;

import org.junit.Test;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.xeiam.xchange.campbx.dto.trade.MyOpenOrders;

/**
* Test BitStamp Full Depth JSON parsing
*/
public class MyOrdersJSONTest {

  @Test
  public void testUnmarshal() throws IOException {

    MyOpenOrders orderBook = new ObjectMapper().readValue(MyOrdersJSONTest.class.getResourceAsStream("/trade/open-orders.json"), MyOpenOrders.class);

    // Verify that the example data was unmarshalled correctly
    List<CampBXOrder> buy = orderBook.getBuy();
    assertThat(buy.size()).isEqualTo(1);
    assertThat(buy.get(0).getInfo()).isNotNull();
    assertThat(buy.get(0).getPrice()).isNull();

    List<CampBXOrder> sell = orderBook.getSell();
    CampBXOrder order = sell.get(0);
    assertThat(order.getPrice()).isEqualTo(new BigDecimal("110.00"));
    assertThat(order.getOrderID()).isEqualTo("599254");
    assertThat(order.getQuantity()).isEqualTo(new BigDecimal("0.10000000"));
    assertThat(order.getDarkPool()).isFalse();
    assertThat(order.getOrderType()).isEqualTo("Quick Sell");
    assertThat(order.getOrderExpiry().toString()).contains("2013");
    assertThat(order.getOrderExpiry().toString()).contains("29");
  }
}
TOP

Related Classes of com.xeiam.xchange.campbx.dto.MyOrdersJSONTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.