use of org.openlmis.stockmanagement.dto.referencedata.LotDto in project openlmis-stockmanagement by OpenLMIS.
the class StockEventProcessContextBuilderTest method testBuildContext.
private void testBuildContext(StockEventDto stockEventDto) {
// given
UUID lotId = UUID.randomUUID();
LotDto lot = new LotDto();
lot.setId(lotId);
StockEventDtoDataBuilder.createStockEventDto();
stockEventDto.getLineItems().get(0).setLotId(lotId);
ProgramDto programDto = new ProgramDto();
FacilityDto facilityDto = new FacilityDto();
ArrayList<OrderableDto> approvedProductDtos = new ArrayList<>();
when(programService.findOne(stockEventDto.getProgramId())).thenReturn(programDto);
when(facilityService.findOne(stockEventDto.getFacilityId())).thenReturn(facilityDto);
when(orderableReferenceDataService.findAll()).thenReturn(approvedProductDtos);
when(lotReferenceDataService.findOne(lotId)).thenReturn(lot);
// when
StockEventProcessContext context = contextBuilder.buildContext(stockEventDto);
// then
assertThat(context.getCurrentUserId(), is(userDto.getId()));
assertThat(context.getProgram(), is(programDto));
assertThat(context.getFacility(), is(facilityDto));
assertThat(context.getAllApprovedProducts(), is(approvedProductDtos));
assertThat(context.findLot(lotId), is(lot));
}
Aggregations