@Test public void musicNoteReadTest7() throws Exception { assertAmbiguityFree(parser, "G"); // Nos garantiza que es válido y no hay ambigüedades MusicNote note = parser.parse("G"); assertTrue(note instanceof RelativeMusicNote); RelativeMusicNote rNote = (RelativeMusicNote) note; // Check the alteration assertNull(rNote.getOctave()); MusicNoteName mNoteName = rNote.getMusicNoteName(); assertTrue(mNoteName instanceof BasicNoteName); BasicNoteName bNoteName = (BasicNoteName) mNoteName; assertEquals("G", bNoteName.getValue()); }
@Test public void musicNoteReadTest4() throws Exception { assertAmbiguityFree(parser, "A#"); // Nos garantiza que es válido y no hay ambigüedades MusicNote note = parser.parse("A#"); assertTrue(note instanceof RelativeMusicNote); RelativeMusicNote rNote = (RelativeMusicNote) note; assertNull(rNote.getOctave()); MusicNoteName mNoteName = rNote.getMusicNoteName(); assertTrue(mNoteName instanceof AlteredNoteName); AlteredNoteName altNoteName = (AlteredNoteName) mNoteName; assertEquals("A", altNoteName.getBasicNoteName().getValue()); Alteration alteration = altNoteName.getAlteration(); assertTrue(alteration instanceof SharpAlteration); SharpAlteration sharpAlteration = (SharpAlteration) alteration; assertEquals("#", sharpAlteration.getValue()); }