@Before
  public void setUp() {
    LocalizerServiceStub localizerServiceStub =
        new LocalizerServiceStub() {

          @Override
          public String getLocalizedTextFromDatabase(
              String localeString, long objectKey, LocalizedObjectTypes objectType) {
            return localizedText;
          }
        };

    facade = new LocalizerFacade(localizerServiceStub, Locale.GERMAN.getLanguage());

    // server side entries
    Product product = new Product();
    product.setKey(PRODUCT_KEY);
    product.setTechnicalProduct(new TechnicalProduct());
    product.setAutoAssignUserEnabled(false);
    ProductFeedback feedback = new ProductFeedback();
    feedback.setAverageRating(new BigDecimal("2.5"));
    product.setProductFeedback(feedback);

    mp = new Marketplace();
    mp.setKey(1);
    mp.setMarketplaceId(MP_ID);
    mp.setOrganization(new Organization());

    catalogEntry = new CatalogEntry();
    catalogEntry.setKey(1);
    catalogEntry.setProduct(product);
    catalogEntry.setMarketplace(mp);
    catalogEntry.setAnonymousVisible(true);
    catalogEntry.setVisibleInCatalog(true);

    catalogEntry2 = new CatalogEntry();
    catalogEntry2.setKey(2);

    catalogEntry3 = new CatalogEntry();
    catalogEntry3.setKey(3);

    VOMarketplace voMp = new VOMarketplace();
    voMp.setMarketplaceId(MP_ID);

    // incoming entries
    voCatalogEntry = new VOCatalogEntry();
    voCatalogEntry.setKey(1);
    voCatalogEntry.setVersion(0);
    voCatalogEntry.setMarketplace(voMp);
    voCatalogEntry.setAnonymousVisible(true);
    voCatalogEntry.setVisibleInCatalog(true);

    voCatalogEntry2 = new VOCatalogEntry();
    voCatalogEntry2.setKey(2);

    voCatalogEntry3 = new VOCatalogEntry();
    voCatalogEntry3.setKey(3);
  }
 @Before
 public void setup() throws Exception {
   dsMock = mock(DataService.class);
   Organization org = new Organization();
   org.setOrganizationId(ORGANIZATIONID);
   PlatformUser user = new PlatformUser();
   user.setUserId(USERID_1);
   user.setLocale("en");
   user.setOrganization(org);
   when(dsMock.getCurrentUser()).thenReturn(user);
   marketplace = new Marketplace();
   marketplace.setKey(1000l);
   doReturn(marketplace).when(dsMock).getReferenceByBusinessKey(any(Marketplace.class));
 }
  /** 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());
  }