Search in sources :

Example 1 with StockCardSummaryV2Dto

use of org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummaryV2DtoTest method shouldCompareStockCards.

@Test
public void shouldCompareStockCards() {
    StockCardSummaryV2Dto stockCard1 = new StockCardSummaryV2DtoDataBuilder().withCanFulfillForMe(new CanFulfillForMeEntryDtoDataBuilder().build()).build();
    StockCardSummaryV2Dto stockCard2 = new StockCardSummaryV2DtoDataBuilder().build();
    assertEquals(-1, stockCard1.compareTo(stockCard2));
    stockCard2 = new StockCardSummaryV2DtoDataBuilder().withCanFulfillForMe(new CanFulfillForMeEntryDtoDataBuilder().build()).build();
    assertEquals(0, stockCard1.compareTo(stockCard2));
    stockCard1 = new StockCardSummaryV2DtoDataBuilder().build();
    stockCard2 = new StockCardSummaryV2DtoDataBuilder().build();
    assertEquals(0, stockCard1.compareTo(stockCard2));
    stockCard2 = new StockCardSummaryV2DtoDataBuilder().withCanFulfillForMe(new CanFulfillForMeEntryDtoDataBuilder().build()).build();
    assertEquals(1, stockCard1.compareTo(stockCard2));
}
Also used : CanFulfillForMeEntryDtoDataBuilder(org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder) StockCardSummaryV2Dto(org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto) StockCardSummaryV2DtoDataBuilder(org.openlmis.stockmanagement.testutils.StockCardSummaryV2DtoDataBuilder) Test(org.junit.Test)

Example 2 with StockCardSummaryV2Dto

use of org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummaryV2DtoTest method shouldGetStockOnHand.

@Test
public void shouldGetStockOnHand() {
    StockCardSummaryV2Dto stockCard = new StockCardSummaryV2DtoDataBuilder().withCanFulfillForMe(new CanFulfillForMeEntryDtoDataBuilder().withStockOnHand(null).build()).withCanFulfillForMe(new CanFulfillForMeEntryDtoDataBuilder().withStockOnHand(12).build()).build();
    assertEquals(new Integer(12), stockCard.getStockOnHand());
}
Also used : CanFulfillForMeEntryDtoDataBuilder(org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder) StockCardSummaryV2Dto(org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto) StockCardSummaryV2DtoDataBuilder(org.openlmis.stockmanagement.testutils.StockCardSummaryV2DtoDataBuilder) Test(org.junit.Test)

Example 3 with StockCardSummaryV2Dto

use of org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummaryV2DtoTest method shouldGetNullStockOnHandIfCanFulfillForMeIsNullOrEmpty.

@Test
public void shouldGetNullStockOnHandIfCanFulfillForMeIsNullOrEmpty() {
    StockCardSummaryV2Dto stockCard = new StockCardSummaryV2DtoDataBuilder().withCanFulfillForMe((Set<CanFulfillForMeEntryDto>) null).build();
    assertEquals(null, stockCard.getStockOnHand());
    stockCard = new StockCardSummaryV2DtoDataBuilder().build();
    assertEquals(null, stockCard.getStockOnHand());
}
Also used : Set(java.util.Set) StockCardSummaryV2Dto(org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto) StockCardSummaryV2DtoDataBuilder(org.openlmis.stockmanagement.testutils.StockCardSummaryV2DtoDataBuilder) Test(org.junit.Test)

Example 4 with StockCardSummaryV2Dto

use of org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummaryV2DtoTest method shouldGetNullStockOnHandIfCanFulfillDoesNotHaveStockOnHand.

@Test
public void shouldGetNullStockOnHandIfCanFulfillDoesNotHaveStockOnHand() {
    StockCardSummaryV2Dto stockCard = new StockCardSummaryV2DtoDataBuilder().withCanFulfillForMe(new CanFulfillForMeEntryDtoDataBuilder().withStockOnHand(null).build()).withCanFulfillForMe(new CanFulfillForMeEntryDtoDataBuilder().withStockOnHand(null).build()).build();
    assertEquals(null, stockCard.getStockOnHand());
}
Also used : CanFulfillForMeEntryDtoDataBuilder(org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder) StockCardSummaryV2Dto(org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto) StockCardSummaryV2DtoDataBuilder(org.openlmis.stockmanagement.testutils.StockCardSummaryV2DtoDataBuilder) Test(org.junit.Test)

Example 5 with StockCardSummaryV2Dto

use of org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto in project openlmis-stockmanagement by OpenLMIS.

the class StockCardSummaryV2DtoTest method shouldImplementToString.

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

Aggregations

Test (org.junit.Test)5 StockCardSummaryV2DtoDataBuilder (org.openlmis.stockmanagement.testutils.StockCardSummaryV2DtoDataBuilder)5 StockCardSummaryV2Dto (org.openlmis.stockmanagement.web.stockcardsummariesv2.StockCardSummaryV2Dto)5 CanFulfillForMeEntryDtoDataBuilder (org.openlmis.stockmanagement.testutils.CanFulfillForMeEntryDtoDataBuilder)3 Set (java.util.Set)1