package ru.job4j;

import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;

/**
 * Task 5.7.1.
 * Create test for my OrderBook
 *
 * Created by Anton Vasilyuk on 09.07.2017.
 * @version 1.0
 */
public class OrderBookTest {

    /**.
     * Link for the OrderBook
     */
    private OrderBook link;

    /**.
     * Preparing for tests
     */
    @Before
    public void preparingForTest() {
        link = new OrderBook();
    }

    /**.
     * Test method addOrder
     */
    @Test
    public void addOrder() {
        boolean result = link.addOrder("Book_One", "Bid", 100.20, 20);
        assertThat(result, is(true));
    }

    /**.
     * Test method deleteOrder
     */
    @Test
    public void deleteOrder() {
        link.addOrder("Book_One", "Bid", 100.20, 20);
        boolean result = link.deleteOrder("Book_One", "Bid", 100.20, 10);
        assertThat(result, is(true));
    }

    /**.
     * Test method printOrder
     */
    @Test
    public void printOrder() {
        link.addOrder("Book_One", "Bid", 100.20, 20);
        link.addOrder("Book_One", "Bid", 100.80, 40);
        link.addOrder("Book_One", "Ask", 100.00, 10);
        link.addOrder("Book_One", "Ask", 98.20, 50);
        link.printOrder("Book_One");
    }
}
@@ -1300,10 +1300,518 @@
 );%0A    %7D
+%0A%0A    /**.%0A     * Time test%0A     */%0A    @Test%0A    public void whenNeedAddMoreElement() %7B%0A        double number = 100.21;%0A        long timeOne = System.currentTimeMillis();%0A        for(int i = 0; i %3C 100000; i++) %7B%0A            link.addOrder(%22Book_One%22, %22Bid%22, number, 1);%0A            number = number + 0.01;%0A            if (number %3E 200.00) %7Bnumber = 100.21;%7D%0A        %7D%0A        long timeTwo = System.currentTimeMillis();%0A        System.out.printf(%22Time adding 100000 element = %25d%22, (timeTwo - timeOne));%0A    %7D
 %0A%7D

add file for chapter_003_5.7.1