package test.com.cjpowered.learn.inventory;

import static org.junit.Assert.*;

import java.time.LocalDate;
import java.util.Collections;
import java.util.List;

import org.junit.Test;

import com.cjpowered.learn.inventory.InventoryDatabase;
import com.cjpowered.learn.inventory.InventoryManager;
import com.cjpowered.learn.inventory.Item;
import com.cjpowered.learn.inventory.Order;
import com.cjpowered.learn.inventory.ace.AceInventoryManager;

/*
 * We need to keep items in stock to prevent back orders. See the README.md
 * for the requirements.
 *
 */

public class InventoryTest {

    @Test
    public void whenNoStockItemsDoNotOrder() {
        // given
        @SuppressWarnings("unused")
        final InventoryDatabase fakeDb = new DatabaseTemplate() {
            @Override
            public List<Item> stockItems() {
                return Collections.emptyList();
            }
        };
        final InventoryManager im = new AceInventoryManager();

        // when
        final LocalDate today = LocalDate.now();
        final List<Order> actual = im.getOrders(today);

        // then
        assertTrue(actual.isEmpty());

    }

}

@@ -122,124 +122,38 @@
 til.
-Collections;%0Aimport java.util.List;%0A%0Aimport org.junit.Test;%0A%0Aimport com.cjpowered.learn.inventory.InventoryDatabase;
+List;%0A%0Aimport org.junit.Test;%0A
 %0Aimp
@@ -208,51 +208,8 @@
 er;%0A
-import com.cjpowered.learn.inventory.Item;%0A
 impo
@@ -539,240 +539,47 @@
     
-@SuppressWarnings(%22unused%22)%0A        final InventoryDatabase fakeDb = new DatabaseTemplate() %7B%0A            @Override%0A            public List%3CItem%3E stockItems() %7B%0A                return Collections.emptyList();%0A            %7D%0A        %7D
+final LocalDate today = LocalDate.now()
 ;%0A  
@@ -660,57 +660,8 @@
 hen%0A
-        final LocalDate today = LocalDate.now();%0A
     

remove unused fake db