@Test public void emptyInEmptyOut() { when(featuredSpeciesDaoMock.fetchSpeciesSortedByExperimentCount()).thenReturn(ImmutableList.of()); assertThat(subject.getSpeciesNamesSortedByExperimentCount()) .isEmpty(); }
public ImmutableList<String> getSpeciesNamesSortedByExperimentCount() { return featuredSpeciesDao.fetchSpeciesSortedByExperimentCount().stream() .map(speciesFactory::create) .map(Species::getReferenceName) .map(StringUtils::capitalize) .distinct() .collect(toImmutableList()); }
FeaturedSpeciesService { public ImmutableList<String> getSpeciesNamesSortedByExperimentCount() { return featuredSpeciesDao.fetchSpeciesSortedByExperimentCount().stream() .map(speciesFactory::create) .map(Species::getReferenceName) .map(StringUtils::capitalize) .distinct() .collect(toImmutableList()); } }
FeaturedSpeciesService { public ImmutableList<String> getSpeciesNamesSortedByExperimentCount() { return featuredSpeciesDao.fetchSpeciesSortedByExperimentCount().stream() .map(speciesFactory::create) .map(Species::getReferenceName) .map(StringUtils::capitalize) .distinct() .collect(toImmutableList()); } FeaturedSpeciesService(FeaturedSpeciesDao featuredSpeciesDao, SpeciesFactory speciesFactory); }
FeaturedSpeciesService { public ImmutableList<String> getSpeciesNamesSortedByExperimentCount() { return featuredSpeciesDao.fetchSpeciesSortedByExperimentCount().stream() .map(speciesFactory::create) .map(Species::getReferenceName) .map(StringUtils::capitalize) .distinct() .collect(toImmutableList()); } FeaturedSpeciesService(FeaturedSpeciesDao featuredSpeciesDao, SpeciesFactory speciesFactory); ImmutableList<String> getSpeciesNamesSortedByExperimentCount(); }
FeaturedSpeciesService { public ImmutableList<String> getSpeciesNamesSortedByExperimentCount() { return featuredSpeciesDao.fetchSpeciesSortedByExperimentCount().stream() .map(speciesFactory::create) .map(Species::getReferenceName) .map(StringUtils::capitalize) .distinct() .collect(toImmutableList()); } FeaturedSpeciesService(FeaturedSpeciesDao featuredSpeciesDao, SpeciesFactory speciesFactory); ImmutableList<String> getSpeciesNamesSortedByExperimentCount();  }