### Question:
FallbackItemScorer extends AbstractItemScorer { @Nonnull @Override public ResultMap scoreWithDetails(long user, @Nonnull Collection<Long> items) { ResultMap results = primaryScorer.scoreWithDetails(user, items); List<Result> allResults = new ArrayList<>(items.size()); LongList toFetch = new LongArrayList(items.size() - results.size()); LongIterator iter = LongIterators.asLongIterator(items.iterator()); while (iter.hasNext()) { final long item = iter.nextLong(); Result r = results.get(item); if (r == null) { toFetch.add(item); } else { allResults.add(new FallbackResult(r, true)); } } if (!toFetch.isEmpty()) { for (Result r: baselineScorer.scoreWithDetails(user, toFetch)) { allResults.add(new FallbackResult(r, false)); } } return new BasicResultMap(allResults); } @Inject  FallbackItemScorer(@PrimaryScorer ItemScorer primary,
                              @BaselineScorer ItemScorer baseline); @Override FallbackResult score(long user, long item); @Nonnull @Override ResultMap scoreWithDetails(long user, @Nonnull Collection<Long> items); @Nonnull ItemScorer getPrimaryScorer(); @Nonnull ItemScorer getBaselineScorer();  }### Answer:
@Test public void testMultipleDetails() { LongSet items = LongUtils.packedSet(10, 30, 39); ResultMap results = scorer.scoreWithDetails(42, items); assertThat(results.size(), equalTo(2)); assertThat(results.getScore(39), equalTo(3.5)); assertThat(results.getScore(30), equalTo(4.0)); assertThat(results.get(39L), instanceOf(FallbackResult.class)); FallbackResult r39 = (FallbackResult) results.get(39L); assertThat(r39.getScore(), equalTo(3.5)); assertThat(r39.isFromPrimary(), equalTo(true)); assertThat(r39.getInnerResult(), notNullValue()); assertThat(r39.getInnerResult().getScore(), equalTo(3.5)); assertThat(results.get(30L), instanceOf(FallbackResult.class)); FallbackResult r30 = (FallbackResult) results.get(30L); assertThat(r30.getScore(), equalTo(4.0)); assertThat(r30.isFromPrimary(), equalTo(false)); assertThat(r30.getInnerResult(), notNullValue()); assertThat(r30.getInnerResult().getScore(), equalTo(4.0)); assertThat(results.get(10L), nullValue()); }