### Question:
ConceptController { public List<Concept> downloadConceptsByNames(List<String> names) throws ConceptDownloadException { HashSet<Concept> result = new HashSet<>(); for (String name : names) { List<Concept> concepts = downloadConceptsByNamePrefix(name); Iterator<Concept> iterator = concepts.iterator(); while (iterator.hasNext()) { Concept next = iterator.next(); if (next == null || !next.containsNameIgnoreLowerCase(name)) { iterator.remove(); } } result.addAll(concepts); } return new ArrayList<>(result); } ConceptController(ConceptService conceptService, ObservationService observationService); List<Concept> downloadConceptsByNamePrefix(String name); void deleteConcept(Concept concept); void deleteConcepts(List<Concept> concepts); void saveConcepts(List<Concept> concepts); Concept getConceptByName(String name); Concept getConceptById(int id); Concept getConceptByUuid(String uuid); List<Concept> downloadConceptsByNames(List<String> names); List<Concept> downloadConceptsByUuid(String[] uuids); List<Concept> searchConceptsLocallyByNamePrefix(String prefix); List<Concept> getConcepts(); void newConcepts(List<Concept> concepts); void resetNewConceptsList(); List<Concept> newConcepts(); List<Concept> getRelatedConcepts(List<FormTemplate> formTemplates); void deleteAllConcepts();  }### Answer:
@Test public void shouldDownloadConceptUsingNonPreferredName() throws Exception, ConceptController.ConceptDownloadException { List<Concept> concepts = new ArrayList<>(); final String nonPreferredName = "NonPreferredName"; Concept aConcept = new Concept() {{ setConceptNames(new ArrayList<ConceptName>() {{ add(new ConceptName() {{ setName("PreferredName"); setPreferred(true); }}); add(new ConceptName() {{ setName(nonPreferredName); setPreferred(false); }}); }}); }}; concepts.add(aConcept); when(service.downloadConceptsByName(nonPreferredName)).thenReturn(concepts); List<String> listOfName = new ArrayList<String>() {{ add(nonPreferredName); }}; List<Concept> expectedResult = new ArrayList<>(); expectedResult.add(aConcept); assertThat(controller.downloadConceptsByNames(listOfName), is(expectedResult)); }