Bug 461 - Array Index Out of Bounds Exception for Optimize method using buffer concept
Summary: Array Index Out of Bounds Exception for Optimize method using buffer concept
Status: CONFIRMED
Alias: None
Product: Warehouse Management System
Classification: Unclassified
Component: Testing V1 (show other bugs)
Version: Specified
Hardware: PC Windows
: High major
Assignee: ANIRUDH
URL:
Depends on:
Blocks:
 
Reported: 2020-11-25 02:26 HKT by ANIRUDH
Modified: 2020-11-25 02:26 HKT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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());
	}