Bug 465

Summary: Error in output of CmdlistWarehouse 1
Product: Warehouse Management System Reporter: ANIRUDH <pvsatavva2-c>
Component: Testing V1Assignee: ANIRUDH <pvsatavva2-c>
Status: CONFIRMED ---    
Severity: critical    
Priority: High    
Version: Specified   
Hardware: PC   
OS: Windows   

Description ANIRUDH 2020-11-25 02:44:09 HKT
Steps to Reproduce:

1. First need to add a slot of size 1.
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 is Full!"

Need to handle this error.

Given test case:

	@Test
	void testListWarehouse2 () { 
		ByteArrayOutputStream outContent = new ByteArrayOutputStream();
		System.setOut(new PrintStream(outContent));
		//String nl = System.lineSeparator();
	    String cmdLine1 = "addSlot|1";
	    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 expectedResults1 = "Slot #1 is Full!";
		assertEquals(expectedResults1, outContent.toString().trim().substring(outContent.toString().trim().lastIndexOf('\n')+1));
	}