use of org.openlmis.stockmanagement.testutils.StockCardLineItemDataBuilder in project openlmis-stockmanagement by OpenLMIS.
the class StockCardRepositoryIntegrationTest method generateInstance.
private StockCard generateInstance(UUID facility, UUID program, UUID product, UUID lot) {
StockEvent event = new StockEventDataBuilder().withoutId().withFacility(facility).withProgram(program).build();
event = stockEventsRepository.save(event);
StockCardLineItem lineItem = new StockCardLineItemDataBuilder().withoutId().withOriginEvent(event).build();
StockCard stockCard = new StockCardDataBuilder(event).withoutId().withOrderable(product).withLot(lot).withLineItem(lineItem).build();
lineItem.setStockCard(stockCard);
return stockCard;
}
use of org.openlmis.stockmanagement.testutils.StockCardLineItemDataBuilder in project openlmis-stockmanagement by OpenLMIS.
the class StockCardSummariesV2DtoBuilderTest method before.
@Before
public void before() {
ReflectionTestUtils.setField(builder, "serviceUrl", "https://openlmis/");
orderable1 = new OrderableDtoDataBuilder().build();
orderable2 = new OrderableDtoDataBuilder().build();
orderable3 = new OrderableDtoDataBuilder().build();
StockEvent event = new StockEventDataBuilder().withFacility(facilityId).withProgram(programId).build();
stockCard = new StockCardDataBuilder(event).buildWithStockOnHandAndLineItemAndOrderableId(12, new StockCardLineItemDataBuilder().buildWithStockOnHand(16), orderable1.getId());
stockCard1 = new StockCardDataBuilder(event).buildWithStockOnHandAndLineItemAndOrderableId(26, new StockCardLineItemDataBuilder().buildWithStockOnHand(30), orderable3.getId());
stockCard2 = new StockCardDataBuilder(event).withLot(UUID.randomUUID()).buildWithStockOnHandAndLineItemAndOrderableId(22, new StockCardLineItemDataBuilder().buildWithStockOnHand(10), orderable3.getId());
fulfillMap = new HashMap<>();
fulfillMap.put(orderable1.getId(), new OrderableFulfillDtoDataBuilder().withCanFulfillForMe(asList(orderable2.getId(), orderable3.getId())).build());
fulfillMap.put(orderable2.getId(), new OrderableFulfillDtoDataBuilder().withCanFulfillForMe(Collections.singletonList(orderable1.getId())).build());
}
use of org.openlmis.stockmanagement.testutils.StockCardLineItemDataBuilder in project openlmis-stockmanagement by OpenLMIS.
the class StockCardLineItemComparatorsTest method shouldReturnZeroIfOccurredDatesAreSame.
@Test
public void shouldReturnZeroIfOccurredDatesAreSame() throws Exception {
// when
StockCardLineItem left = new StockCardLineItemDataBuilder().build();
StockCardLineItem right = new StockCardLineItemDataBuilder().build();
// then
assertThat(byOccurredDate().compare(left, right), is(0));
}
use of org.openlmis.stockmanagement.testutils.StockCardLineItemDataBuilder in project openlmis-stockmanagement by OpenLMIS.
the class StockCardLineItemComparatorsTest method shouldReturnPositiveIfFirstOccurredDateIsLater.
@Test
public void shouldReturnPositiveIfFirstOccurredDateIsLater() throws Exception {
// when
StockCardLineItem left = new StockCardLineItemDataBuilder().build();
StockCardLineItem right = new StockCardLineItemDataBuilder().withOccurredDatePreviousDay().build();
// then
assertThat(byOccurredDate().compare(left, right), greaterThan(0));
}
use of org.openlmis.stockmanagement.testutils.StockCardLineItemDataBuilder in project openlmis-stockmanagement by OpenLMIS.
the class StockCardLineItemComparatorsTest method shouldReturnZeroIfReasonPrioritiesAreNull.
@Test
public void shouldReturnZeroIfReasonPrioritiesAreNull() throws Exception {
// when
StockCardLineItem left = new StockCardLineItemDataBuilder().build();
StockCardLineItem right = new StockCardLineItemDataBuilder().build();
// then
assertThat(byReasonPriority().compare(left, right), is(0));
}
Aggregations