### Question:
ConceptController { public Concept getConceptByName(String name) throws ConceptFetchException { try { List<Concept> concepts = conceptService.getConceptsByName(name); for (Concept concept : concepts) { if (concept.getName().equals(name)) { return concept; } } } catch (IOException e) { throw new ConceptFetchException(e); } return null; } 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 shouldReturnAConceptThatMatchesNameExactly() throws Exception, ConceptController.ConceptFetchException { String conceptName = "conceptName"; List<Concept> conceptList = asList(createConceptByName("someName"),createConceptByName(conceptName)); when(service.getConceptsByName(conceptName)).thenReturn(conceptList); Concept conceptByName = controller.getConceptByName(conceptName); assertThat(conceptByName.getName(),is(conceptName)); }
@Test public void shouldReturnNullIfNoConceptMatchesTheName() throws Exception, ConceptController.ConceptFetchException { String conceptName = "conceptName"; List<Concept> conceptList = asList(createConceptByName("someName"),createConceptByName("someOtherName")); when(service.getConceptsByName(conceptName)).thenReturn(conceptList); Concept conceptByName = controller.getConceptByName(conceptName); assertThat(conceptByName,nullValue()); }