Bug 462

Summary: Array Index Out of Bounds Exception for CmdAddSlot
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:31:30 HKT
Steps to Reproduce:

1. Set the date of adding the slot
2. Give the command addSlot

Throwing an exception i.e Array Index Out of Bounds

Need to handle this error.

Given test case:

@Test //Array index out of bounds exception
	void testAddNewSlot3() {
		ByteArrayOutputStream outContent = new ByteArrayOutputStream();
	    System.setOut(new PrintStream(outContent));
	    String dateSet = "setNewDay|13-Oct-2020";
	    String [] dateParts = dateSet.split("\\|");
	    (new CmdSetDate()).execute(dateParts);
	    String cmdLine = "addSlot";
	    String [] cmdParts = cmdLine.split("\\|");
	    (new CmdAddSlot()).execute(cmdParts);
	    System.out.println(outContent.toString());
	    //String msg = "Checking when the size of the item is bigger than any slot";
	    assertEquals("Insufficient command arguments!", outContent.toString().trim().substring(outContent.toString().trim().lastIndexOf('\n')+1));
	    
	}