Search in sources :

Example 6 with PhysicalInventoryLineItemDto

use of org.openlmis.stockmanagement.dto.PhysicalInventoryLineItemDto in project openlmis-stockmanagement by OpenLMIS.

the class PhysicalInventoryValidatorTest method shouldRejectWhenLineItemHasNoOrderable.

@Test(expected = ValidationMessageException.class)
public void shouldRejectWhenLineItemHasNoOrderable() {
    // given
    PhysicalInventoryDto inventory = newInventory();
    inventory.setLineItems(Collections.singletonList(new PhysicalInventoryLineItemDto()));
    doNothing().when(vvmValidator).validate(eq(inventory.getLineItems()), anyString(), eq(false));
    // when
    validator.validateDraft(inventory, inventory.getId());
    // then
    verify(vvmValidator, atLeastOnce()).validate(eq(inventory.getLineItems()), anyString(), eq(false));
}
Also used : PhysicalInventoryLineItemDto(org.openlmis.stockmanagement.dto.PhysicalInventoryLineItemDto) PhysicalInventoryDto(org.openlmis.stockmanagement.dto.PhysicalInventoryDto) Test(org.junit.Test)

Example 7 with PhysicalInventoryLineItemDto

use of org.openlmis.stockmanagement.dto.PhysicalInventoryLineItemDto in project openlmis-stockmanagement by OpenLMIS.

the class PhysicalInventoryServiceTest method verifyLineItems.

private void verifyLineItems(List<PhysicalInventoryLineItemDto> expected, List<PhysicalInventoryLineItem> actual) {
    PhysicalInventoryLineItemDto lineItemDto = expected.get(0);
    PhysicalInventoryLineItem lineItem = actual.get(0);
    assertThat(lineItem.getQuantity(), is(lineItemDto.getQuantity()));
    assertThat(lineItem.getOrderableId(), is(lineItemDto.getOrderableId()));
}
Also used : PhysicalInventoryLineItem(org.openlmis.stockmanagement.domain.physicalinventory.PhysicalInventoryLineItem) PhysicalInventoryLineItemDto(org.openlmis.stockmanagement.dto.PhysicalInventoryLineItemDto)

Aggregations

PhysicalInventoryLineItemDto (org.openlmis.stockmanagement.dto.PhysicalInventoryLineItemDto)7 PhysicalInventoryDto (org.openlmis.stockmanagement.dto.PhysicalInventoryDto)3 Test (org.junit.Test)2 PhysicalInventory (org.openlmis.stockmanagement.domain.physicalinventory.PhysicalInventory)2 PhysicalInventoryLineItem (org.openlmis.stockmanagement.domain.physicalinventory.PhysicalInventoryLineItem)1 ValidationMessageException (org.openlmis.stockmanagement.exception.ValidationMessageException)1