@Before public void before() throws StockLineExistedException{ stock = new Stock(); stockLine1 = new Item("book1","This is book1",99.9f,100); stockLine2 = new Item("book2","This is book2",88,2); stockLine3 = new Item("book3","This is book3",99,1); stockLine4 = new Item("book4","This is book4",10,0); stock.createStockLine(stockLine1); stock.createStockLine(stockLine2); stock.createStockLine(stockLine3); stock.createStockLine(stockLine4); }
@Test(expected=StockLineExistedException.class) /* * test duplicate case */ public void testCreateStockLine() throws StockLineExistedException{ stock.createStockLine(stockLine1); }