Bug 459

Summary: Array Index Out of Bounds Exception findPerfectSubset 1
Product: Warehouse Management System Reporter: ANIRUDH <pvsatavva2-c>
Component: Testing V1Assignee: ANIRUDH <pvsatavva2-c>
Status: CONFIRMED ---    
Severity: major    
Priority: High    
Version: Specified   
Hardware: PC   
OS: Windows   

Description ANIRUDH 2020-11-25 02:17:50 HKT
Steps to Reproduce:

1. Give the items of size 5, 2 along with the arrival and the departure dates.
2. Give the slot size of 7.

Throwing an exception i.e Array Index Out of Bounds for findOnePerfectFit in the optimize method!

Given test case:

@Test
	void testOptimize11()
	{
		Warehouse wh =  Warehouse.getInstance();
		ArrayList<Slot> slots = new ArrayList<>();
		Slot ss = new Slot(7);
		slots.add(ss);
		//wh.setSlots(slots);
		Item is1 = new Item(5, new Day("13-Oct-2020"),new Day("20-Oct-2020"));
		Item is2 = new Item(2, new Day("13-Oct-2020"),new Day("20-Oct-2020"));
		ArrayList<Item> itemArray = new ArrayList<Item>();
		itemArray.add(is1);
		itemArray.add(is2);
		Optimize op = new Optimize();
		op.findOnePerfectSubsets(itemArray, itemArray.size(), 6, ss);
		assertEquals(true, op.getFound());
	}