Bug 462 - Array Index Out of Bounds Exception for CmdAddSlot
Summary: Array Index Out of Bounds Exception for CmdAddSlot
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:31 HKT by ANIRUDH
Modified: 2020-11-25 02:31 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: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));
	    
	}