| Summary: | Exception Not Handled(IndexOutOfBoundsException) WMS V1 | ||
|---|---|---|---|
| Product: | Warehouse Management System | Reporter: | ANIRUDH <pvsatavva2-c> |
| Component: | Testing | Assignee: | ANIRUDH <pvsatavva2-c> |
| Status: | CONFIRMED --- | ||
| Severity: | major | ||
| Priority: | High | ||
| Version: | Specified | ||
| Hardware: | PC | ||
| OS: | Windows | ||
When an item was added to an extra slot which is not created/present, exception was thrown. |
Note: Input given in the test case function in Version 1 of the system Steps to reproduce: Give the input for the list of items: Item 1: 1 Item 2: 2 Item 3: 3 Added a couple of slots with the sizes of 5 and 1 respectively. Below is the test case which threw error: @Test public void testOptimize5() { ByteArrayOutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); Item item1 = new Item(1,new Day("13-Oct-2020"),new Day("20-Oct-2020"), 1); Item item2 = new Item(2,new Day("13-Oct-2020"),new Day("20-Nov-2020"), 2); Item item3 = new Item(3,new Day("13-Oct-2020"),new Day("25-Oct-2020"), 3); ArrayList<Slot> slots = new ArrayList<>(); slots.add(new Slot(5)); slots.add(new Slot(1)); slots.get(0).addItem(item1); slots.get(1).addItem(item2); slots.get(2).addItem(item3); //Threw an exception at this line Warehouse.createInstance(slots); Warehouse.getInstance().printItemsInSlots(); //addition ArrayList<Item> items = new ArrayList<>(); items.add(item1); items.add(item2); items.add(item3); //addition Warehouse.getInstance().optimize(items); assertEquals("Optimizing was done.", outContent.toString().trim().substring(outContent.toString().trim().lastIndexOf('\n')+1)); } When items are added to the slots for checking whether the system can optimize or not, an exception was thrown. Actual Output: IndexOutOfBoundsException Expected Output: Optimizing was done