### Question:
SetHatMidiPatternEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for(ProgressionUnit pUnit : queueState.getStructure()) { String jfugueStr = "T" + queueState.getQueueItem().getBpm() + " "; for (ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { for (Integer k : pBar.getHatPattern().getAsIntegerArray()) { jfugueStr += intToDuration(pUnit.getKey(), k) + " "; } pBar.setHatMidiPattern(new Pattern(jfugueStr)); } } return queueState; }  @Override QueueState set(QueueState queueState); public int HAT_OCTAVE; }### Answer:
@Test public void shouldSetMidiPattern(){ setHatPatternEvent = new SetHatMidiPatternEvent(); queueState = setHatPatternEvent.set(queueState); Pattern p1b1 = queueState.getQueueItem().getProgression().getStructure().get(0).getProgressionUnitBars().get(0).getHatMidiPattern(); Pattern p2b1 = queueState.getQueueItem().getProgression().getStructure().get(1).getProgressionUnitBars().get(0).getHatMidiPattern(); assertThat(p1b1.toString()).isEqualToIgnoringCase("T77 f#5s rs f#5s rs f#5s rs f#5s rs f#5s rs f#5s rs f#5s rs f#5s rs "); assertThat(p2b1.toString()).isEqualToIgnoringCase("T77 rs rs f#5s f#5s rs rs f#5s f#5s rs rs f#5s f#5s rs rs f#5s f#5s "); }