/** Tests population of category DTO with names when category is held in virtual catalog. */
  @Test
  public void testPopulateDtoNameValuesWhenCatalogIsVirtual() {
    final CategoryDTO categoryDto = new CategoryDTO();
    final Category mockCategory = context.mock(Category.class);
    final LocaleDependantFields mockDependantFields = context.mock(LocaleDependantFields.class);

    final Catalog mockCatalog = context.mock(Catalog.class);
    context.checking(
        new Expectations() {
          {
            oneOf(mockCategory).getCatalog();
            will(returnValue(mockCatalog));
            oneOf(mockCatalog).getSupportedLocales();
            will(returnValue(Arrays.asList(LOCALE_EN)));

            oneOf(mockCategory).getLocaleDependantFieldsWithoutFallBack(LOCALE_EN);
            will(returnValue(mockDependantFields));

            oneOf(mockDependantFields).getDisplayName();
            will(returnValue(DISPLAY_VALUE_EN_LOCALE.getValue()));
          }
        });

    categoryAdapter.populateDtoNameValues(mockCategory, categoryDto);

    final List<DisplayValue> nameValues = categoryDto.getNameValues();
    assertEquals(DISPLAY_VALUE_EN_LOCALE.getLanguage(), nameValues.get(0).getLanguage());
    assertEquals(DISPLAY_VALUE_EN_LOCALE.getValue(), nameValues.get(0).getValue());
    assertEquals(1, nameValues.size());
  }