/** Test of setDuration method, of class MidiNote. */
 @Test
 public void setDuration() {
   System.out.println("setDuration");
   long duration = 5;
   MidiNote instance = new MidiNote();
   instance.setDuration(duration);
   long result = instance.getDuration();
   assertEquals(duration, result);
 }
  @Test
  public void noteEventRefreshOnFieldChange() throws InvalidMidiDataException {
    System.out.println("noteEventRefreshOnFieldChange");
    MidiNote instance = new MidiNote();
    MidiEvent noteOnEvent = instance.getNoteOnEvent();
    MidiEvent noteOffEvent = instance.getNoteOffEvent();

    assertNoteEventEqual(
        noteOnEvent, 0, (byte) -112, (byte) 0, (byte) MidiNote.DEFAULT_VELOCITY, true);
    assertNoteEventEqual(noteOffEvent, 0, (byte) -128, (byte) 0, (byte) 0, true);

    instance.setPitch(92);
    noteOnEvent = instance.getNoteOnEvent();
    noteOffEvent = instance.getNoteOffEvent();
    assertNoteEventEqual(
        noteOnEvent, 0, (byte) -112, (byte) 92, (byte) MidiNote.DEFAULT_VELOCITY, true);
    assertNoteEventEqual(noteOffEvent, 0, (byte) -128, (byte) 92, (byte) 0, true);

    instance.setStartTime(16L);
    noteOnEvent = instance.getNoteOnEvent();
    noteOffEvent = instance.getNoteOffEvent();
    assertNoteEventEqual(
        noteOnEvent, 16, (byte) -112, (byte) 92, (byte) MidiNote.DEFAULT_VELOCITY, true);
    assertNoteEventEqual(noteOffEvent, 16, (byte) -128, (byte) 92, (byte) 0, true);

    instance.setDuration(8L);
    noteOnEvent = instance.getNoteOnEvent();
    noteOffEvent = instance.getNoteOffEvent();
    assertNoteEventEqual(
        noteOnEvent, 16, (byte) -112, (byte) 92, (byte) MidiNote.DEFAULT_VELOCITY, true);
    assertNoteEventEqual(noteOffEvent, 24, (byte) -128, (byte) 92, (byte) 0, true);

    instance.setVelocity(120);
    noteOnEvent = instance.getNoteOnEvent();
    noteOffEvent = instance.getNoteOffEvent();
    assertNoteEventEqual(noteOnEvent, 16, (byte) -112, (byte) 92, (byte) 120, true);
    assertNoteEventEqual(noteOffEvent, 24, (byte) -128, (byte) 92, (byte) 0, true);

    instance.setChannel(2);
    noteOnEvent = instance.getNoteOnEvent();
    noteOffEvent = instance.getNoteOffEvent();
    assertNoteEventEqual(noteOnEvent, 16, (byte) -110, (byte) 92, (byte) 120, true);
    assertNoteEventEqual(noteOffEvent, 24, (byte) -126, (byte) 92, (byte) 0, true);
  }