use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class QuantityValidatorTest method shouldNotRejectWhenStockOnHandMatchesQuantityAndNoAdjustments.
@Test
public void shouldNotRejectWhenStockOnHandMatchesQuantityAndNoAdjustments() throws Exception {
// given
LocalDate firstDate = dateFromYear(2015);
StockEventDto event = createPhysicalInventoryEventDto(firstDate.plusDays(1), 0, null);
setContext(event);
// when
quantityValidator.validate(event);
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class QuantityValidatorTest method shouldNotRejectWhenStockOnHandFromMiddleIsLessThanStockAdjustment.
@Test
public void shouldNotRejectWhenStockOnHandFromMiddleIsLessThanStockAdjustment() {
// given
StockCard card = new StockCardDataBuilder(new StockEventDataBuilder().build()).withLineItem(buildPhysicalInventoryLineItem(100, Month.JANUARY)).withLineItem(buildPhysicalInventoryLineItem(80, Month.MARCH)).build();
StockEventDto event = createPhysicalInventoryEventDto(LocalDate.of(2017, Month.FEBRUARY, 28), 15, null);
mockCardFound(event, card);
// when
quantityValidator.validate(event);
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class ReasonExistenceValidatorTest method shouldNotThrowErrorIfEventHasNoReasonId.
@Test
public void shouldNotThrowErrorIfEventHasNoReasonId() throws Exception {
// given
StockEventDto stockEventDto = StockEventDtoDataBuilder.createStockEventDto();
stockEventDto.getLineItems().get(0).setReasonId(null);
setContext(stockEventDto);
// when
reasonExistenceValidator.validate(stockEventDto);
// then: no exception
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class ReceiveIssueReasonValidatorTest method eventThatHasSourceAndA_reasonOfDebitShouldNotPass.
@Test
public void eventThatHasSourceAndA_reasonOfDebitShouldNotPass() throws Exception {
StockEventDto stockEventDto = createStockEventDto();
stockEventDto.getLineItems().get(0).setSourceId(UUID.randomUUID());
stockEventDto.getLineItems().get(0).setDestinationId(null);
stockEventDto.getLineItems().get(0).setReasonId(UUID.randomUUID());
testErrorCase(ERROR_EVENT_RECEIVE_REASON_TYPE_INVALID, stockEventDto, debitAdhocReason);
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class ReceiveIssueReasonValidatorTest method eventThatHasSourceButNoReasonShouldPass.
@Test
public void eventThatHasSourceButNoReasonShouldPass() throws Exception {
// given
StockEventDto stockEventDto = createStockEventDto();
stockEventDto.getLineItems().get(0).setSourceId(UUID.randomUUID());
stockEventDto.getLineItems().get(0).setDestinationId(null);
stockEventDto.getLineItems().get(0).setReasonId(null);
setContext(stockEventDto);
// when
receiveIssueReasonValidator.validate(stockEventDto);
// then: no error exception
}
Aggregations