Example #1
0
 // restToStringTest(): integer duration, decimal duration
 @Test
 public void restToStringTest() {
   Rest a = new Rest(5);
   Rest b = new Rest(4.5);
   assertEquals(".5.0", a.toString());
   assertEquals(".4.5", b.toString());
 }
Example #2
0
 // restPlayTest():
 @Test
 public void restPlayTest() {
   Rest a = new Rest(5);
   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();
   }
 }
Example #3
0
 // restEqualsFalseTest(): covers all false partitions
 @Test
 public void restEqualsFalseTest() {
   Rest a = new Rest(5);
   Rest b = new Rest(10);
   assertFalse(a.equals(b));
 }
Example #4
0
 // restHashCodeTest()
 @Test
 public void restHashCodeTest() {
   Rest a = new Rest(5);
   Rest b = new Rest(5);
   assertEquals(a.hashCode(), b.hashCode());
 }
Example #5
0
 // restTransposeTest()
 @Test
 public void restTransposeTest() {
   Rest a = new Rest(5);
   Rest b = new Rest(5);
   assertEquals(a, b.transpose(2));
 }
Example #6
0
 // restDurationTest()
 @Test
 public void restDurationTest() {
   Rest a = new Rest(5);
   assertTrue(5 == a.duration());
 }
Example #7
0
 // restConstructorTest()
 @Test
 public void restConstructorTest() {
   Rest a = new Rest(5);
   assertEquals(".5.0", a.toString());
 }