### Question:
ArpeggioGenerator implements IArpeggioGenerator { @Override public Map<Integer, Arpeggio> selectFromARateDistributedList(Map<Integer, List<Arpeggio>> weightedArpeggios) { Map<Integer, Arpeggio> filtered = new HashMap<>(); for (Entry<Integer, List<Arpeggio>> entry : weightedArpeggios.entrySet()) { List<Arpeggio> distributedArpeggios = distributeWeightedArpeggios(entry.getValue()); Arpeggio selectedArpeggio = distributedArpeggios.get(new Random().nextInt(distributedArpeggios.size())); filtered.put(entry.getKey(), selectedArpeggio); } return filtered; } @Autowired  ArpeggioGenerator(IArpeggioSelector arpeggioSelector, IMidiWeighter midiWeighter, @Value("${num_of_generated_mixes}") Integer numOfGeneratedMixes); List<Integer> generateTemplate(List<ProgressionUnit> progressionUnits, ProgressionType unitType); List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB); Map<Integer, List<Arpeggio>> getArpeggioOptions(List<ProgressionUnit> progressionUnits, ProgressionUnit.ProgressionType unitType, SourceData sourceData); @Override List<Arpeggio> distributeWeightedArpeggios(List<Arpeggio> weightedArpeggios); @Override Map<Integer, Arpeggio> selectFromARateDistributedList(Map<Integer, List<Arpeggio>> weightedArpeggios); @Override void weightArpeggioOptions(List<ProgressionUnit> progressionUnits, ProgressionType unitType, Map<Integer, List<Arpeggio>> arpeggioMap); @Override void setPatternWithTemplate(List<ProgressionUnit> progressionUnits, ProgressionType unitType, Map<Integer, Arpeggio> selectedArpeggios, SourceData sourceData, Integer bpm);  }### Answer:
@Test public void shouldSelectHigestRated() { Arpeggio arpeggioOne = new Arpeggio(); arpeggioOne.setId(1); arpeggioOne.incrementWeight(WeightClass.OK); arpeggioOne.incrementWeight(WeightClass.OK); arpeggioOne.incrementWeight(WeightClass.GOOD); Arpeggio arpeggioTwo = new Arpeggio(); arpeggioTwo.setId(2); arpeggioTwo.incrementWeight(WeightClass.GOOD); arpeggioTwo.incrementWeight(WeightClass.GOOD); arpeggioTwo.incrementWeight(WeightClass.GOOD); Arpeggio arpeggioThree = new Arpeggio(); arpeggioThree.setId(3); arpeggioThree.incrementWeight(WeightClass.GOOD); List<Arpeggio> listOne = new ArrayList<>(); listOne.add(arpeggioOne); List<Arpeggio> listTwo = new ArrayList<>(); listTwo.add(arpeggioOne); listTwo.add(arpeggioTwo); List<Arpeggio> listThree = new ArrayList<>(); listThree.add(arpeggioOne); listThree.add(arpeggioTwo); listThree.add(arpeggioThree); Map<Integer, List<Arpeggio>> ratedArpeggioInput = new HashMap<>(); ratedArpeggioInput.put(1, listOne); ratedArpeggioInput.put(2, listTwo); ratedArpeggioInput.put(3, listThree); Map<Integer, Arpeggio> highestRated = arpeggioGenerator.selectFromARateDistributedList(ratedArpeggioInput); assertThat(highestRated.size()).isEqualTo(3); }