Search in sources :

Example 6 with CanFulfillForMeEntryDtoDataBuilder

use of org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder in project openlmis-stockmanagement by OpenLMIS.

the class CanFulfillForMeEntryDtoTest method shouldImplementToString.

@Test
public void shouldImplementToString() {
    CanFulfillForMeEntryDto params = new CanFulfillForMeEntryDtoDataBuilder().build();
    ToStringTestUtils.verify(CanFulfillForMeEntryDto.class, params);
}
Also used : CanFulfillForMeEntryDtoDataBuilder(org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder) CanFulfillForMeEntryDto(org.openlmis.stockmanagement.web.stockcardsummariesv2.CanFulfillForMeEntryDto) Test(org.junit.Test)

Example 7 with CanFulfillForMeEntryDtoDataBuilder

use of org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummariesV2DtoBuilderTest method shouldBuildStockCardSummaries.

@Test
public void shouldBuildStockCardSummaries() throws Exception {
    List<StockCard> stockCards = asList(stockCard, stockCard1);
    LocalDate asOfDate = LocalDate.now();
    List<StockCardSummaryV2Dto> result = builder.build(asList(orderable1, orderable2, orderable3), stockCards, fulfillMap, asOfDate);
    StockCardSummaryV2Dto summary1 = new StockCardSummaryV2Dto(new ObjectReferenceDtoDataBuilder().withPath(ORDERABLES).withId(orderable1.getId()).build(), asSet(new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard1, orderable3, asOfDate), new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard, orderable1, asOfDate)));
    StockCardSummaryV2Dto summary2 = new StockCardSummaryV2Dto(new ObjectReferenceDtoDataBuilder().withPath(ORDERABLES).withId(orderable2.getId()).build(), asSet(new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard, orderable1, asOfDate)));
    StockCardSummaryV2Dto summary3 = new StockCardSummaryV2Dto(new ObjectReferenceDtoDataBuilder().withPath(ORDERABLES).withId(orderable3.getId()).build(), asSet(new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard1, orderable3, asOfDate)));
    assertEquals(3, result.size());
    assertThat(result, hasItems(summary1, summary2, summary3));
}
Also used : CanFulfillForMeEntryDtoDataBuilder(org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder) ObjectReferenceDtoDataBuilder(org.openlmis.stockmanagement.testutils.ObjectReferenceDtoDataBuilder) StockCard(org.openlmis.stockmanagement.domain.card.StockCard) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 8 with CanFulfillForMeEntryDtoDataBuilder

use of org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummariesV2DtoBuilderTest method shouldBuildStockCardSummariesForCurrentDate.

@Test
public void shouldBuildStockCardSummariesForCurrentDate() throws Exception {
    List<StockCard> stockCards = asList(stockCard, stockCard1);
    LocalDate asOfDate = LocalDate.now();
    List<StockCardSummaryV2Dto> result = builder.build(Collections.singletonList(orderable1), stockCards, fulfillMap, null);
    StockCardSummaryV2Dto summary1 = new StockCardSummaryV2Dto(new ObjectReferenceDtoDataBuilder().withPath(ORDERABLES).withId(orderable1.getId()).build(), asSet(new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard1, orderable3, asOfDate), new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard, orderable1, asOfDate)));
    assertEquals(1, result.size());
    assertThat(result, hasItems(summary1));
}
Also used : CanFulfillForMeEntryDtoDataBuilder(org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder) ObjectReferenceDtoDataBuilder(org.openlmis.stockmanagement.testutils.ObjectReferenceDtoDataBuilder) StockCard(org.openlmis.stockmanagement.domain.card.StockCard) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 9 with CanFulfillForMeEntryDtoDataBuilder

use of org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummariesV2DtoBuilderTest method shouldBuildStockCardSummariesWithMultipleStockCardsForOrderable.

@Test
public void shouldBuildStockCardSummariesWithMultipleStockCardsForOrderable() throws Exception {
    List<StockCard> stockCards = asList(stockCard, stockCard1, stockCard2);
    LocalDate asOfDate = LocalDate.now();
    List<StockCardSummaryV2Dto> result = builder.build(asList(orderable1, orderable2, orderable3), stockCards, fulfillMap, asOfDate);
    StockCardSummaryV2Dto summary1 = new StockCardSummaryV2Dto(new ObjectReferenceDtoDataBuilder().withPath(ORDERABLES).withId(orderable1.getId()).build(), asSet(new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard1, orderable3, asOfDate), new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard2, orderable3, asOfDate), new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard, orderable1, asOfDate)));
    StockCardSummaryV2Dto summary2 = new StockCardSummaryV2Dto(new ObjectReferenceDtoDataBuilder().withPath(ORDERABLES).withId(orderable2.getId()).build(), asSet(new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard, orderable1, asOfDate)));
    StockCardSummaryV2Dto summary3 = new StockCardSummaryV2Dto(new ObjectReferenceDtoDataBuilder().withPath(ORDERABLES).withId(orderable3.getId()).build(), asSet(new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard1, orderable3, asOfDate), new CanFulfillForMeEntryDtoDataBuilder().buildWithStockCardAndOrderable(stockCard2, orderable3, asOfDate)));
    assertEquals(3, result.size());
    assertThat(result, hasItems(summary1, summary2, summary3));
}
Also used : CanFulfillForMeEntryDtoDataBuilder(org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder) ObjectReferenceDtoDataBuilder(org.openlmis.stockmanagement.testutils.ObjectReferenceDtoDataBuilder) StockCard(org.openlmis.stockmanagement.domain.card.StockCard) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)9 CanFulfillForMeEntryDtoDataBuilder (org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder)9 LocalDate (java.time.LocalDate)5 StockCard (org.openlmis.stockmanagement.domain.card.StockCard)5 ObjectReferenceDtoDataBuilder (org.openlmis.stockmanagement.testutils.ObjectReferenceDtoDataBuilder)5 StockCardSummaryV2DtoDataBuilder (org.openlmis.stockmanagement.testutils.StockCardSummaryV2DtoDataBuilder)3 StockCardSummaryV2Dto (org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto)3 CanFulfillForMeEntryDto (org.openlmis.stockmanagement.web.stockcardsummariesv2.CanFulfillForMeEntryDto)1