Bug 466

Summary: Error in output of CmdlistWarehouse 2
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:46:11 HKT
Steps to Reproduce:

1. First need to add a slot of size 2.
2. Secondly, need to add an item of size 1.
2. Next, need to run the command "listWarehouse"

Throwing an error: This test case is not showing the required output which is "Slot #1, volume is 1, free volume is 1"

Need to handle this error.

@Test 
	void testListWarehouse3 () { 
		ByteArrayOutputStream outContent = new ByteArrayOutputStream();
		System.setOut(new PrintStream(outContent));
		String nl = System.lineSeparator();
	    String cmdLine1 = "addSlot|2";
	    String [] cmdParts1 = cmdLine1.split("\\|");
	    (new CmdAddSlot()).execute(cmdParts1);
	    String cmdLine2 = "addItem|1";
	    String [] cmdParts2 = cmdLine2.split("\\|");
	    (new CmdAddItem()).execute(cmdParts2);
	    String cmdLine6 = "listWarehouse";
	    String [] cmdParts6 = cmdLine6.split("\\|");
		(new CmdListWarehouse()).execute(cmdParts6);
	    String expectedResults2 = "Slot #1, volume is 1, free volume is 1";
		assertEquals(expectedResults2, outContent.toString().trim().substring(outContent.toString().trim().lastIndexOf('\n')+1));
	}