@Test public void testReferencesForPurchasedInCategory() { final UserModel user = userService.getUserForUID("dejol"); final CategoryModel category = categoryService.getCategoryForCode("cameras"); List<ProductModel> result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory( category, user, Collections.EMPTY_LIST, false, null); Assert.assertEquals(4, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory( category, user, Collections.EMPTY_LIST, false, NumberUtils.INTEGER_ONE); Assert.assertEquals(1, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory( category, user, Arrays.asList(ProductReferenceTypeEnum.SIMILAR), false, null); Assert.assertEquals(1, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory( category, user, Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), false, null); Assert.assertEquals(2, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory( category, user, Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), true, null); Assert.assertEquals(1, result.size()); final ProductModel product = result.get(0); Assert.assertEquals("adapterDC", product.getCode()); Assert.assertEquals("adapter", product.getName()); }
@Test public void testBasicProduct() throws Exception { final ProductModel product = processFile(productId, "base_product-", new ProductContent()); Assert.assertEquals("name", product.getName(Locale.ENGLISH)); Assert.assertNull("name", product.getName(Locale.GERMAN)); Assert.assertEquals("description", product.getDescription(Locale.ENGLISH)); Assert.assertNull("description", product.getDescription(Locale.GERMAN)); Assert.assertEquals("ean", product.getEan()); Assert.assertEquals("manufacturer", product.getManufacturerName()); Assert.assertEquals("manufacturerAID", product.getManufacturerAID()); Assert.assertEquals("pieces", product.getUnit().getName()); Assert.assertEquals("approved", product.getApprovalStatus().getCode()); Assert.assertEquals("eu-vat-half", product.getEurope1PriceFactory_PTG().getCode()); Assert.assertEquals(sequenceId, product.getSequenceId()); Assert.assertEquals("Staged", product.getCatalogVersion().getVersion()); Assert.assertEquals("apparelProductCatalog", product.getCatalogVersion().getCatalog().getId()); }
@Override public void populate(final ProductModel source, final ProductData target) { Assert.notNull(source, "Parameter source cannot be null."); Assert.notNull(target, "Parameter target cannot be null."); target.setCode(source.getCode()); target.setName(source.getName()); target.setUrl(getProductModelUrlResolver().resolve(source)); }