@Test
 public void updateCatalogEntry() throws Exception {
   CatalogEntry entry = CatalogEntryAssembler.updateCatalogEntry(catalogEntry, voCatalogEntry);
   assertNotNull(entry);
   assertEquals(voCatalogEntry.getKey(), entry.getKey());
   assertEquals(PRODUCT_KEY, entry.getProduct().getKey());
   assertEquals(voCatalogEntry.getVersion(), entry.getVersion());
 }
  @Test
  public void toVOCatalogEntry_ForListing() throws Exception {
    // when
    VOCatalogEntry voCe =
        CatalogEntryAssembler.toVOCatalogEntry(
            catalogEntry, facade, PerformanceHint.ONLY_FIELDS_FOR_LISTINGS);

    // then
    assertEquals(catalogEntry.getProduct().getKey(), voCe.getService().getKey());
  }
  /** domain object -> value object */
  @Test
  public void toVOCatalogEntry() {

    List<CategoryToCatalogEntry> categoryToCatalogEntry = new ArrayList<CategoryToCatalogEntry>();
    CategoryToCatalogEntry ctc = new CategoryToCatalogEntry();
    ctc.setCatalogEntry(catalogEntry);
    Category category = new Category();
    category.setCategoryId("categoryId");
    category.setMarketplaceKey(mp.getKey());
    category.setMarketplace(mp);
    category.setKey(3333);
    ctc.setCategory(category);
    ctc.setKey(2222);
    categoryToCatalogEntry.add(ctc);
    catalogEntry.setCategoryToCatalogEntry(categoryToCatalogEntry);
    catalogEntry.getProduct().setVendor(new Organization());

    VOCatalogEntry voEntry = CatalogEntryAssembler.toVOCatalogEntry(catalogEntry, facade);
    assertNotNull(voEntry);
    assertEquals(catalogEntry.getKey(), voEntry.getKey());
    assertEquals(catalogEntry.getProduct().getKey(), voEntry.getService().getKey());
    assertEquals(catalogEntry.getVersion(), voEntry.getVersion());
    Assert.assertEquals(catalogEntry.isAnonymousVisible(), voEntry.isAnonymousVisible());
    Assert.assertEquals(catalogEntry.isVisibleInCatalog(), voEntry.isVisibleInCatalog());
    if (catalogEntry.getMarketplace() != null || voEntry.getMarketplace() != null) {
      assertNotNull(catalogEntry.getMarketplace());
      assertNotNull(voEntry.getMarketplace());
      assertEquals(
          catalogEntry.getMarketplace().getMarketplaceId(),
          voEntry.getMarketplace().getMarketplaceId());
    }

    assertNotNull(voEntry.getCategories());
    assertEquals(1, voEntry.getCategories().size());
    assertEquals(category.getCategoryId(), voEntry.getCategories().get(0).getCategoryId());
  }