### Question:
InfoProvider { public TvInfo findTvInfoInDatabase(Map<MediaIdType, String> ids) { Collection<TvInfo> matchingInfos = tvInfoRepository.findByTvrageIdOrTvmazeIdOrTvdbIdOrImdbId(ids.getOrDefault(TVRAGE, "-1"), ids.getOrDefault(TVMAZE, "-1"), ids.getOrDefault(TVDB, "-1"), ids.getOrDefault(IMDB, "-1")); return matchingInfos.stream().max(TvInfo::compareTo).orElse(null); }  boolean canConvert(MediaIdType from, MediaIdType to); static Set<MediaIdType> getConvertibleFrom(MediaIdType from); boolean canConvertAny(Set<MediaIdType> from, Set<MediaIdType> to); MediaInfo convert(Map<MediaIdType, String> identifiers); @Cacheable(cacheNames = "infos", sync = true) //sync=true is currently apparently not supported by Caffeine. synchronizing by method is good enough because we'll likely rarely hit this method concurrently with different parameters synchronized MediaInfo convert(String value, MediaIdType fromType); TvInfo findTvInfoInDatabase(Map<MediaIdType, String> ids); MovieInfo findMovieInfoInDatabase(Map<MediaIdType, String> ids); @Cacheable(cacheNames = "titles", sync = true) List<MediaInfo> search(String title, MediaIdType titleType); static Set<MediaIdType> TV_ID_TYPES; static Set<MediaIdType> MOVIE_ID_TYPES; static Set<MediaIdType> REAL_ID_TYPES; }### Answer:
@Test public void shouldGetInfoWithMostIds() { TvInfo mostInfo = new TvInfo("abc", "abc", "abc", null, null, null, null); when(tvInfoRepositoryMock.findByTvrageIdOrTvmazeIdOrTvdbIdOrImdbId(anyString(), anyString(), anyString(), anyString())).thenReturn(Arrays.asList( mostInfo, new TvInfo("abc", "abc", null, null, null, null, null), new TvInfo("abc", null, null, null, null, null, null) )); TvInfo info = testee.findTvInfoInDatabase(new HashMap<>()); assertEquals(mostInfo, info); }