Bug 514

Summary: Items added from queue to the warehouse is limited to the number of items left instead of limiting it to the volume released by those items.
Product: Warehouse Management System Reporter: Nurs <nzakirov2-c>
Component: TestingAssignee: ANIRUDH <pvsatavva2-c>
Status: CONFIRMED ---    
Severity: critical CC: nzakirov2-c
Priority: ---    
Version: Specified   
Hardware: PC   
OS: Windows   

Description Nurs 2020-12-04 02:42:08 HKT
Steps to reproduce:
1. Initialize the warehouse and add some slots
2. Fully fill all the slots with items
3. Add some extra items so that they will be in the queue
4. Change the date so that, number of items left the warehouse is smaller than the number of items in the queue. However, the total volume of the left items should be bigger than the total volume of the items in the queue.

The test case given below does not show the state of the Warehouse:
-There are 3 slots of sizes 1, 2, 3 respectively;
-Date is 27-Oct-2020
-There is one item of size 3 in slot 3, the due date is 2-Nov-2020

Expected output: slot 2 should contain two items of size 1
Actual output: slot 2 contains only 1 item even though there is a space for the second item of size 1.


@Test
	void testCmdAddItemFromQueue_04() {
	ByteArrayOutputStream outContent = new ByteArrayOutputStream();
	    System.setOut(new PrintStream(outContent));
	    
	    String cmdLine5 = "addItem|2|29-Oct-2020";
  	    String [] cmdParts5 = cmdLine5.split("\\|");
  	    (new CmdAddItem()).execute(cmdParts5);
	    
	    String cmdLine3 = "addItem|1|10-Nov-2020";
  	    String [] cmdParts3 = cmdLine3.split("\\|");
  	    (new CmdAddItem()).execute(cmdParts3);
  	    
  	    String cmdLine2 = "addItem|1|10-Nov-2020";
	    String [] cmdParts2 = cmdLine2.split("\\|");
	    (new CmdAddItem()).execute(cmdParts2);
	    
	    String cmdLine1 = "addItem|1|10-Nov-2020";
  	    String [] cmdParts1 = cmdLine1.split("\\|");
  	    (new CmdAddItem()).execute(cmdParts1);
	    
	    String cmdLine = "startNewDate|1-Nov-2020";
	    String [] cmdParts = cmdLine.split("\\|");
	    (new CmdSetDate()).execute(cmdParts);
	    (new CmdDeliverExpiredItem()).execute(cmdParts);
    	(new CmdAddItemFromQueue()).execute(cmdParts);
    	(new CmdVisualize()).execute(cmdParts);
    	
    	String[] output = outContent.toString().split("\n");

    	assertEquals("Slot #2 with Volume: 2, Remaining Volume: 0 : [Item #12(Size:1), Item #13(Size:1)]", output[output.length-3].trim());
	}