package com.github.sbouclier.result;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.sbouclier.utils.StreamUtils;
import org.junit.Test;

import java.io.IOException;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.StringStartsWith.startsWith;

/**
 * OrderBookResult test
 *
 * @author Stéphane Bouclier
 */
public class OrderBookResultTest {

    @Test
    public void should_return_to_string() throws IOException {

        // Given
        final String jsonResult = StreamUtils.getResourceAsString(this.getClass(), "json/order_book.mock.json");
        OrderBookResult mockResult = new ObjectMapper().readValue(jsonResult, OrderBookResult.class);

        // When
        final String toString = mockResult.toString();

        // Then
        assertThat(toString, startsWith("OrderBookResult"));
    }
}

@@ -181,16 +181,45 @@
 ception;
+%0Aimport java.math.BigDecimal;
 %0A%0Aimport
@@ -265,16 +265,65 @@
 rtThat;%0A
+import static org.hamcrest.core.IsEqual.equalTo;%0A
 import s
@@ -440,16 +440,16 @@
 ier%0A */%0A
-
 public c
@@ -472,24 +472,364 @@
 sultTest %7B%0A%0A
+    @Test%0A    public void should_construct_market() %7B%0A        OrderBookResult.Market market = new OrderBookResult.Market(BigDecimal.TEN, BigDecimal.ONE, 5000);%0A%0A        assertThat(market.price, equalTo(BigDecimal.TEN));%0A        assertThat(market.volume, equalTo(BigDecimal.ONE));%0A        assertThat(market.timestamp, equalTo(5000));%0A    %7D%0A%0A
     @Test%0A  

test market constructor