use of org.openlmis.stockmanagement.testutils.StockEventDtoDataBuilder.createStockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardServiceIntegrationTest method shouldGetStockCardWithCalculatedSohWhenFindStockCard.
@Test
public void shouldGetStockCardWithCalculatedSohWhenFindStockCard() throws Exception {
// given
StockEventDto stockEventDto = StockEventDtoDataBuilder.createStockEventDto();
stockEventDto.getLineItems().get(0).setSourceId(null);
stockEventDto.getLineItems().get(0).setDestinationId(null);
StockEvent savedEvent = save(stockEventDto, randomUUID());
// when
UUID cardId = stockCardRepository.findByOriginEvent(savedEvent).getId();
StockCardDto card = stockCardService.findStockCardById(cardId);
// then
assertThat(card.getStockOnHand(), is(stockEventDto.getLineItems().get(0).getQuantity()));
}
use of org.openlmis.stockmanagement.testutils.StockEventDtoDataBuilder.createStockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardServiceIntegrationTest method shouldReassignPhysicalInventoryReasonNames.
@Test
public void shouldReassignPhysicalInventoryReasonNames() throws Exception {
// given
StockEventDto stockEventDto = StockEventDtoDataBuilder.createStockEventDto();
stockEventDto.getLineItems().get(0).setSourceId(null);
stockEventDto.getLineItems().get(0).setDestinationId(null);
stockEventDto.getLineItems().get(0).setReasonId(null);
StockEvent savedEvent = save(stockEventDto, randomUUID());
// when
UUID cardId = stockCardRepository.findByOriginEvent(savedEvent).getId();
StockCardDto card = stockCardService.findStockCardById(cardId);
// then
String reasonName = card.getLineItems().get(0).getLineItem().getReason().getName();
assertThat(reasonName, is("Overstock"));
}
Aggregations