@Test public void testGetSummary() { Map<String, Set<Movie>> movieSetGroupedByGenre = movieService .groupMovieSetByGenre(movieSet); Summary summary = null; GenreSummary genreSummary = null; summary = movieService.getSummary(movieSetGroupedByGenre); genreSummary = new GenreSummary(); genreSummary.setGenre(ACTION_AND_ADVENTURE.toString()); genreSummary.setMovieTitleCount(5); genreSummary.setSoapTitleCount(0); assertTrue("Summary does not contain genre summary for " + ACTION_AND_ADVENTURE.toString(), summary.getGenreSummary() .contains(genreSummary)); genreSummary = new GenreSummary(); genreSummary.setGenre(HORROR.toString()); genreSummary.setMovieTitleCount(6); genreSummary.setSoapTitleCount(0); assertTrue( "Summary does not contain genre summary for " + HORROR.toString(), summary.getGenreSummary() .contains(genreSummary)); }
@Override public Summary getSummary(Map<String, Set<Movie>> movieSetGroupedByGenre) { Set<Movie> movieSetFilteredByGenre = null; int movieTitleCount = 0; int soapTitleCount = 0; long sumOfSizeOfAllTitles = 0L; GenreSummary genreSummary = null; List<GenreSummary> genreSummaryList = new ArrayList<GenreSummary>(); Summary summary = null; for (String genre : genreList) { movieSetFilteredByGenre = movieSetGroupedByGenre.get(genre); genreSummary = getSummaryByGenre(movieSetFilteredByGenre, genre); sumOfSizeOfAllTitles += genreSummary .getSumOfSizeOfAllTitlesInThisGenre(); movieTitleCount += genreSummary.getMovieTitleCount(); soapTitleCount += genreSummary.getSoapTitleCount(); genreSummaryList.add(genreSummary); } summary = new Summary(); summary.setGenreSummary(genreSummaryList); summary.setMovieTitleCount(movieTitleCount); summary.setSoapTitleCount(soapTitleCount); summary.setSumOfSizeOfAllTitles(sumOfSizeOfAllTitles); return summary; }
MovieServiceImpl implements MovieService { @Override public Summary getSummary(Map<String, Set<Movie>> movieSetGroupedByGenre) { Set<Movie> movieSetFilteredByGenre = null; int movieTitleCount = 0; int soapTitleCount = 0; long sumOfSizeOfAllTitles = 0L; GenreSummary genreSummary = null; List<GenreSummary> genreSummaryList = new ArrayList<GenreSummary>(); Summary summary = null; for (String genre : genreList) { movieSetFilteredByGenre = movieSetGroupedByGenre.get(genre); genreSummary = getSummaryByGenre(movieSetFilteredByGenre, genre); sumOfSizeOfAllTitles += genreSummary .getSumOfSizeOfAllTitlesInThisGenre(); movieTitleCount += genreSummary.getMovieTitleCount(); soapTitleCount += genreSummary.getSoapTitleCount(); genreSummaryList.add(genreSummary); } summary = new Summary(); summary.setGenreSummary(genreSummaryList); summary.setMovieTitleCount(movieTitleCount); summary.setSoapTitleCount(soapTitleCount); summary.setSumOfSizeOfAllTitles(sumOfSizeOfAllTitles); return summary; } }
MovieServiceImpl implements MovieService { @Override public Summary getSummary(Map<String, Set<Movie>> movieSetGroupedByGenre) { Set<Movie> movieSetFilteredByGenre = null; int movieTitleCount = 0; int soapTitleCount = 0; long sumOfSizeOfAllTitles = 0L; GenreSummary genreSummary = null; List<GenreSummary> genreSummaryList = new ArrayList<GenreSummary>(); Summary summary = null; for (String genre : genreList) { movieSetFilteredByGenre = movieSetGroupedByGenre.get(genre); genreSummary = getSummaryByGenre(movieSetFilteredByGenre, genre); sumOfSizeOfAllTitles += genreSummary .getSumOfSizeOfAllTitlesInThisGenre(); movieTitleCount += genreSummary.getMovieTitleCount(); soapTitleCount += genreSummary.getSoapTitleCount(); genreSummaryList.add(genreSummary); } summary = new Summary(); summary.setGenreSummary(genreSummaryList); summary.setMovieTitleCount(movieTitleCount); summary.setSoapTitleCount(soapTitleCount); summary.setSumOfSizeOfAllTitles(sumOfSizeOfAllTitles); return summary; } MovieServiceImpl(); }
MovieServiceImpl implements MovieService { @Override public Summary getSummary(Map<String, Set<Movie>> movieSetGroupedByGenre) { Set<Movie> movieSetFilteredByGenre = null; int movieTitleCount = 0; int soapTitleCount = 0; long sumOfSizeOfAllTitles = 0L; GenreSummary genreSummary = null; List<GenreSummary> genreSummaryList = new ArrayList<GenreSummary>(); Summary summary = null; for (String genre : genreList) { movieSetFilteredByGenre = movieSetGroupedByGenre.get(genre); genreSummary = getSummaryByGenre(movieSetFilteredByGenre, genre); sumOfSizeOfAllTitles += genreSummary .getSumOfSizeOfAllTitlesInThisGenre(); movieTitleCount += genreSummary.getMovieTitleCount(); soapTitleCount += genreSummary.getSoapTitleCount(); genreSummaryList.add(genreSummary); } summary = new Summary(); summary.setGenreSummary(genreSummaryList); summary.setMovieTitleCount(movieTitleCount); summary.setSoapTitleCount(soapTitleCount); summary.setSumOfSizeOfAllTitles(sumOfSizeOfAllTitles); return summary; } MovieServiceImpl(); @Override SortedSet<Movie> getMovieSet(String path); String getMovieDirectory(); @Override Set<Movie> filterMovieSetByGenre(Set<Movie> movieSet, String genre); @Override Map<String, Set<Movie>> groupMovieSetByGenre(Set<Movie> movieSet); @Override Summary getSummary(Map<String, Set<Movie>> movieSetGroupedByGenre); @SuppressWarnings("unused") @Override GenreSummary getSummaryByGenre(Set<Movie> movieSetFilteredByGenre,
			String genre); }
MovieServiceImpl implements MovieService { @Override public Summary getSummary(Map<String, Set<Movie>> movieSetGroupedByGenre) { Set<Movie> movieSetFilteredByGenre = null; int movieTitleCount = 0; int soapTitleCount = 0; long sumOfSizeOfAllTitles = 0L; GenreSummary genreSummary = null; List<GenreSummary> genreSummaryList = new ArrayList<GenreSummary>(); Summary summary = null; for (String genre : genreList) { movieSetFilteredByGenre = movieSetGroupedByGenre.get(genre); genreSummary = getSummaryByGenre(movieSetFilteredByGenre, genre); sumOfSizeOfAllTitles += genreSummary .getSumOfSizeOfAllTitlesInThisGenre(); movieTitleCount += genreSummary.getMovieTitleCount(); soapTitleCount += genreSummary.getSoapTitleCount(); genreSummaryList.add(genreSummary); } summary = new Summary(); summary.setGenreSummary(genreSummaryList); summary.setMovieTitleCount(movieTitleCount); summary.setSoapTitleCount(soapTitleCount); summary.setSumOfSizeOfAllTitles(sumOfSizeOfAllTitles); return summary; } MovieServiceImpl(); @Override SortedSet<Movie> getMovieSet(String path); String getMovieDirectory(); @Override Set<Movie> filterMovieSetByGenre(Set<Movie> movieSet, String genre); @Override Map<String, Set<Movie>> groupMovieSetByGenre(Set<Movie> movieSet); @Override Summary getSummary(Map<String, Set<Movie>> movieSetGroupedByGenre); @SuppressWarnings("unused") @Override GenreSummary getSummaryByGenre(Set<Movie> movieSetFilteredByGenre,
			String genre);  }