// mergePlayEmptyTest(): m1 and/or m2 empty @Test public void mergePlayEmptyTest() { Merge a = new Merge(new Rest(0), new Rest(0)); try { SequencePlayer player = new SequencePlayer(140, 12); a.play(player, 0); assertEquals("Meta event: END_OF_TRACK Tick: 0\n", player.toString()); } catch (MidiUnavailableException mue) { mue.printStackTrace(); } catch (InvalidMidiDataException imde) { imde.printStackTrace(); } }
// mergePlayEqualsTest(): m1 = m2 @Test public void mergePlayEqualsTest() { Merge a = new Merge(new Note(1.0, new Pitch('C')), new Note(1.0, new Pitch('C'))); try { SequencePlayer player = new SequencePlayer(140, 12); a.play(player, 0); assertEquals( "Event: NOTE_ON Pitch: 60 Tick: 0\n" + "Event: NOTE_OFF Pitch: 60 Tick: 12\n" + "Event: NOTE_ON Pitch: 60 Tick: 12\n" + "Event: NOTE_OFF Pitch: 60 Tick: 24\n" + "Meta event: END_OF_TRACK Tick: 24\n", player.toString()); } catch (MidiUnavailableException mue) { mue.printStackTrace(); } catch (InvalidMidiDataException imde) { imde.printStackTrace(); } }
// mergeDifferentDurationTest(): m1, m2 different duration @Test public void mergeDifferentDurationTest() { Merge a = new Merge(new Rest(1), new Note(5, new Pitch('A'))); assertTrue(6 == a.duration()); }
// mergeSameDurationTest(): m1, m2 same duration @Test public void mergeSameDurationTest() { Merge a = new Merge(new Rest(5), new Note(5, new Pitch('A'))); assertTrue(10 == a.duration()); }
// mergeEmptyTest(): m1 and/or m2 empty @Test public void mergeEmptyTest() { Merge a = new Merge(new Rest(0), new Rest(0)); assertEquals(".0.0 .0.0", a.toString()); }
// mergeConstructorTest() @Test public void mergeConstructorTest() { Merge a = new Merge(new Note(2., new Pitch('C')), new Note(1., new Pitch('F'))); assertEquals("C2.0 F1.0", a.toString()); }
// mergeToStringDifferentTest(): m1 and m2 non-equals @Test public void mergeToStringDifferentTest() { Merge a = new Merge(new Note(2, new Pitch('C')), new Note(5, new Pitch('A'))); assertEquals("C2.0 A5.0", a.toString()); }
// mergeToStringEqualsTest(): m1 and m2 equals @Test public void mergeToStringEqualsTest() { Merge a = new Merge(new Note(5, new Pitch('A')), new Note(5, new Pitch('A'))); assertEquals("A5.0 A5.0", a.toString()); }