Bug 461

Summary: Array Index Out of Bounds Exception for Optimize method using buffer concept
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:26:03 HKT
Steps to Reproduce:

1. Give the slot size of 7.
2. Give the item of sizes 3, 4 along with the arrival and the departure dates.
3. Run the file.

Throwing an exception i.e Array Index Out of Bounds for check perfect subset in optimize method.

Given test case:


@Test
	void testOptimizeBuffer1()
	{
		ByteArrayOutputStream outContent = new ByteArrayOutputStream();
	    System.setOut(new PrintStream(outContent));
		Warehouse wh = Warehouse.getInstance();
		Optimize op = new Optimize();
		Slot slot2 = new Slot(7);
		
		Item item1 = new Item(3,new Day("13-Oct-2020"),new Day("20-Oct-2020"));
		Item item2 = new Item(4,new Day("13-Oct-2020"),new Day("20-Nov-2020"));
		
		wh.optimize();
		assertEquals("The system is optimized.", outContent.toString());
	}