@Test public void testCategoryCodePresentTwoCategories() { ProductItemCategory osCategory = ProductItemCategory.builder().id(2).categoryCode("os").build(); ProductItem item = ProductItem.builder().categories(ImmutableSet.of(ramCategory, osCategory)).build(); assert ProductItemPredicates.categoryCode("ram").apply(item); }
@Test public void testItemCallCategoryExists() { ProductItemCategory category2 = ProductItemCategory.builder() .id(12) .categoryCode("new category") .build(); ProductItem item1 = item.toBuilder().categories(ImmutableSet.of(category2)).build(); ProductItemPrice price = ProductItemPrice.builder().id(1) .categories(category) .item(item1) .build(); ProductItem newItem = item().apply(price); assertEquals(newItem.getCategories(), ImmutableSet.of(category2)); }
@BeforeMethod public void setup() { category = ProductItemCategory.builder().id(1).categoryCode("category").build(); price = ProductItemPrice.builder().id(1).build(); item = ProductItem.builder().id(1) .capacity(2.0f) .description("an item") .prices(price) .build(); }
public T fromProductItemCategory(ProductItemCategory in) { return this .id(in.getId()) .name(in.getName()) .categoryCode(in.getCategoryCode()); } }
public T fromProductItemCategory(ProductItemCategory in) { return this .id(in.getId()) .name(in.getName()) .categoryCode(in.getCategoryCode()); } }
@BeforeGroups(groups = { "unit" }) public void setupContext() { ramCategory = ProductItemCategory.builder().id(1).categoryCode("ram").build(); item = ProductItem.builder().id(1).description("a test item").categories(ImmutableSet.of(ramCategory)).capacity( 2.0f).units("GB").build(); emptyItem = ProductItem.builder().id(1).build(); }