use of org.openlmis.stockmanagement.domain.physicalinventory.PhysicalInventory in project openlmis-stockmanagement by OpenLMIS.
the class PhysicalInventoryServiceTest method verifyPhysicalInventorySavedWithoutSohAndAsDraft.
private void verifyPhysicalInventorySavedWithoutSohAndAsDraft() {
PhysicalInventory captured = inventoryArgumentCaptor.getValue();
Integer previousStockOnHand = captured.getLineItems().get(0).getPreviousStockOnHandWhenSubmitted();
assertNull(previousStockOnHand);
assertFalse(captured.getIsDraft());
}
use of org.openlmis.stockmanagement.domain.physicalinventory.PhysicalInventory in project openlmis-stockmanagement by OpenLMIS.
the class PhysicalInventoryServiceTest method shouldReturnSubmittedInventoryIfIsFound.
@Test
public void shouldReturnSubmittedInventoryIfIsFound() throws Exception {
PhysicalInventory submittedInventory = createInventoryDraft(orderableId, programId, facilityId);
shouldSearchBasedOnIsDraft(submittedInventory, false);
}
use of org.openlmis.stockmanagement.domain.physicalinventory.PhysicalInventory in project openlmis-stockmanagement by OpenLMIS.
the class PhysicalInventoryServiceTest method shouldSaveDraftWhenPassValidations.
@Test
public void shouldSaveDraftWhenPassValidations() throws Exception {
// given
UUID programId = UUID.randomUUID();
UUID facilityId = UUID.randomUUID();
PhysicalInventoryDto piDto = createInventoryDto(programId, facilityId);
UUID physicalInventoryId = randomUUID();
// when
physicalInventoryService.saveDraft(piDto, physicalInventoryId);
// then
verify(physicalInventoryRepository, times(1)).save(inventoryArgumentCaptor.capture());
PhysicalInventory captured = inventoryArgumentCaptor.getValue();
verifyLineItems(piDto.getLineItems(), captured.getLineItems());
assertEquals(programId, captured.getProgramId());
assertEquals(facilityId, captured.getFacilityId());
assertEquals(true, captured.getIsDraft());
verify(homeFacilityPermissionService, times(1)).checkProgramSupported(programId);
verify(permissionService, times(1)).canEditPhysicalInventory(programId, facilityId);
verify(validator, times(1)).validateDraft(piDto, physicalInventoryId);
}
Aggregations