use of org.openlmis.stockmanagement.dto.StockCardDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardSummariesServiceTest method shouldReturnPageOfStockCards.
@Test
public void shouldReturnPageOfStockCards() throws Exception {
// given
UUID programId = randomUUID();
UUID facilityId = randomUUID();
PageRequest pageRequest = new PageRequest(0, 1);
UUID orderableId = randomUUID();
OrderableDto orderable = createOrderableDto(orderableId, "");
StockCard card = createStockCard(orderableId, randomUUID());
when(cardRepository.findByProgramIdAndFacilityId(programId, facilityId, pageRequest)).thenReturn(new PageImpl<>(singletonList(card), pageRequest, 10));
when(orderableReferenceDataService.findAll()).thenReturn(singletonList(orderable));
when(lotReferenceDataService.getAllLotsOf(any(UUID.class))).thenReturn(emptyList());
// when
Page<StockCardDto> stockCards = stockCardSummariesService.findStockCards(programId, facilityId, pageRequest);
// then
assertThat(stockCards.getContent().size(), is(1));
assertThat(stockCards.getTotalElements(), is(10L));
assertThat(stockCards.getContent().get(0).getExtraData().get("vvmStatus"), is("STAGE_2"));
}
Aggregations