ParserManager { public List<Content> parseMatchableItems(List<MatchableItem> items){ List<Content> parsedContentList = new ArrayList<Content>(); for(MatchableItem item : items){ Content parsedContent = parseMatchableItem(item); if (parsedContent != null) { parsedContentList.add(parsedContent); } } return parsedContentList; }  List<ContentParser> getParsers(); @Autowired void setParsers(List<ContentParser> parsers); List<Content> parseMatchableItems(List<MatchableItem> items); Content parseMatchableItem(MatchableItem item);  }
@Test public void shouldParseOneMovieAndTwoTvShowsWhenParseTwoInputsOfTvSHowsAndOneOfMovie() throws Exception { String movieInput1 = "Oz the Great and Powerful 2013 1080p BluRay DTS-HDMA 7 1 x264-LEGi0N"; String tvShowInput1 = "Almost Naked Animals S03E09 A Luck Be A Robot 720p HDTV x264-DEADPOOL"; String tvShowInput2 = "The Half Hour S02E07 Jonah Ray 720p HDTV x264-YesTV"; List<MatchableItem> matchableItems = Arrays.asList(getMatchItem(movieInput1), getMatchItem(tvShowInput1), getMatchItem(tvShowInput2)); Movie movie = new Movie("Oz the Great and Powerful", 2013, Quality.FULLHD); TvShow tvShow1 = new TvShow("Almost Naked Animals", 3, 9, Quality.HD); TvShow tvShow2 = new TvShow("The Half Hour", 2, 7, Quality.HD); List<Content> expectedParsedContent = Arrays.asList(movie, tvShow1, tvShow2); List<Content> parsedContents = parserManager.parseMatchableItems(matchableItems); assertEquals(expectedParsedContent, parsedContents); }