Bug 467

Summary: Error in output of CmdOptimize 1
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:49:28 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 "optimize"

Throwing an error: This test case is not showing the required output which is "Manually Optimized!"

Need to handle this error.

Given test case:


@Test //Error: not letting to add items to the warehouse
	void testManuallyOptimize4() throws ExInvalidCommand, ExWrongDateFormat, ExInsufficientArguments {
		Warehouse wh = Warehouse.getInstance();
		ByteArrayOutputStream outContent = new ByteArrayOutputStream();
	    System.setOut(new PrintStream(outContent));
	    SystemDate.createTheInstance("13-Oct-2020");
	    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 cmdLine = "optimize";	    
	    String [] cmdParts = cmdLine.split("\\|");
	    (new CmdOptimize()).execute(cmdParts);
	    System.out.println(outContent.toString());
	    Main.acceptCmd(cmdParts);
	    assertEquals("Manually Optimized!", outContent.toString().trim().substring(outContent.toString().trim().lastIndexOf('\n')+1));
	    
	}