### Question:
SetMelodicSynthEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { Map<ProgressionType, List<HiveChord>> pTypeToChords = new HashMap<>(); for (ProgressionUnit progressionUnit : queueState.getStructure()) { List<HiveChord> chords = new ArrayList<>(); for (ProgressionUnitBar pBar : progressionUnit.getProgressionUnitBars()) { chords.add(pBar.getChord()); } pTypeToChords.put(progressionUnit.getType(), chords); } Map<ProgressionType, List<String>> pTypeToMelody = new HashMap<>(); for (Map.Entry<ProgressionType, List<HiveChord>> entry : pTypeToChords.entrySet()) { List<String> jFugueMelody = melodydGenerator.generate(entry.getValue(), numOfAltMelodies); List<String> melodies = new ArrayList<>(); for (String melody: jFugueMelody) { melodies.add("T" + queueState.getQueueItem().getBpm() + " " + melody); } pTypeToMelody.put(entry.getKey(), melodies); } for (ProgressionUnit progressionUnit : queueState.getStructure()) { progressionUnit.addMelodies(pTypeToMelody.get(progressionUnit.getType())); } return queueState; } @Autowired  SetMelodicSynthEvent(MelodyGenerator melodydGenerator, MelodicExtractor melodicExtractor, IBachChoraleDal bachChoraleDal); @Override QueueState set(QueueState queueState); Map<ProgressionType, List<BachChorale>> createTypeToBachChorales(List<BachChorale> choralesDb, Map<ProgressionType, List<HarmonyExtraction>> typeToHarmonicExtractionMap); List<String> findUnusedNotes(List<String> usedNotes, List<String> availableNotes); Map<ProgressionType, List<String>> createTypeToChordSequenceMap(Map<ProgressionType, int[]> typeToMatchLengthAndOffset, List<BachChorale> chorales); List<BachChorale> createMatchingChorales(List<BachChorale> bachChorales, List<HarmonyExtraction> harmonyExtractions); LongestMatchResponse getLongestMatch(List<BachChorale> bachChorales, List<HarmonyExtraction> harmonyExtractions); int interateCollection(int indexOffset, List<BachChorale> bachChorales, List<HarmonyExtraction> extractions);  }### Answer:
@Test public void shouldSetMelodies(){ int NUM_OF_ALT_MELODIES = 2; queueState = setMelodicSynthEvent.set(queueState); assertThat(queueState.getStructure().get(0).getMelodies()).isNotEmpty(); assertThat(queueState.getStructure().get(0).getMelodies().size()).isEqualTo(NUM_OF_ALT_MELODIES); }