Bug 467 - Error in output of CmdOptimize 1
Summary: Error in output of CmdOptimize 1
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:49 HKT by ANIRUDH
Modified: 2020-11-25 02:49 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: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));
	    
	}