ProductManager { public void removeProduct(Owner owner, Product entity) { if (owner == null) { throw new IllegalArgumentException("owner is null"); } if (entity == null) { throw new IllegalArgumentException("entity is null"); } Product existing = this.ownerProductCurator.getProductById(owner, entity.getId()); if (existing == null) { throw new IllegalStateException("Product has not yet been created"); } this.removeProductsByUuids(owner, Arrays.asList(existing.getUuid())); } @Inject  ProductManager(EntitlementCertificateGenerator entitlementCertGenerator,
        OwnerContentCurator ownerContentCurator, OwnerProductCurator ownerProductCurator,
        ProductCurator productCurator); Product createProduct(ProductDTO dto, Owner owner); @Transactional Product updateProduct(ProductDTO update, Owner owner, boolean regenerateEntitlementCerts); @Transactional @Traceable ImportResult<Product> importProducts(@TraceableParam("owner") Owner owner,
        Map<String, ? extends ProductInfo> productData, Map<String, Content> importedContent); void removeProduct(Owner owner, Product entity); @Transactional void removeAllProducts(Owner owner); void removeProducts(Owner owner, Collection<Product> products); void removeProductsByUuids(Owner owner, Collection<String> productUuids); static boolean isChangedBy(Product entity, ProductDTO dto); static boolean isChangedBy(Product entity, ProductInfo update);  }
@Test public void testRemoveProduct() { Owner owner = this.createOwner("test-owner-1", "Test Owner 1"); Product product = this.createProduct("p1", "prod1", owner); assertTrue(this.ownerProductCurator.isProductMappedToOwner(product, owner)); this.productManager.removeProduct(owner, product); assertFalse(this.ownerProductCurator.isProductMappedToOwner(product, owner)); assertNotNull(this.productCurator.get(product.getUuid())); assertEquals(0, this.ownerProductCurator.getOwnerCount(product)); verifyZeroInteractions(this.mockEntCertGenerator); }