### Question:
CategoryUtils { public List<SelectOption> createCategories() { List<SelectOption> options = new ArrayList<>(); options.add(new SelectOptionImpl("ALL", ts.getTranslation(LibraryConstants.ALL))); options.addAll(categoriesManagerCache.getCategories().stream() .map(category -> new SelectOptionImpl(category.getName(), ts.getTranslation(category.getName()))) .collect(Collectors.toList())); return options; } CategoryUtils(); @Inject  CategoryUtils(CategoriesManagerCache categoriesManagerCache,
                         TranslationService ts); List<SelectOption> createCategories();  }### Answer:
@Test public void testCreateCategories() { when(this.categoriesManagerCache.getCategories()).thenReturn(new HashSet<>(Arrays.asList(new Others(), new Decision()))); List<SelectOption> categories = this.categoryUtils.createCategories(); assertEquals(3, categories.size()); assertTrue(categories.stream().anyMatch(selectOption -> selectOption.getSelector().equals("ALL"))); assertTrue(categories.stream().anyMatch(selectOption -> selectOption.getSelector().equals(new Others().getName()))); assertTrue(categories.stream().anyMatch(selectOption -> selectOption.getSelector().equals(new Decision().getName()))); }