/** Tests populateParentCategory. */ @Test public void testPopulateParentCategory() { final Category mockCategory = context.mock(Category.class); final CategoryDTO categoryDto = new CategoryDTO(); categoryDto.setParentCategoryCode(null); categoryAdapter.populateParentCategory(mockCategory, categoryDto); categoryDto.setParentCategoryCode(""); categoryAdapter.populateParentCategory(mockCategory, categoryDto); context.checking( new Expectations() { { oneOf(mockCachingService).findCategoryByCode(PARENT_CATEGORY_CODE, CATALOG_CODE); will(returnValue(null)); oneOf(mockCategory).setParent(null); } }); categoryDto.setParentCategoryCode(PARENT_CATEGORY_CODE); categoryDto.setCatalogCode(CATALOG_CODE); categoryAdapter.populateParentCategory(mockCategory, categoryDto); }