@Test public void testCreateFromString() { InternationalStandardRecordingCode isrc = null; isrc = InternationalStandardRecordingCode.createFromString("BRBMG0300729"); Assert.assertEquals("BR", isrc.getCountry()); Assert.assertEquals("BMG", isrc.getRegistrant()); Assert.assertEquals(3, isrc.getYear()); Assert.assertEquals(729, isrc.getNumber()); Assert.assertEquals("BRBMG0300729", isrc.toString()); isrc = InternationalStandardRecordingCode.createFromString("USPR37300012"); Assert.assertEquals("US", isrc.getCountry()); Assert.assertEquals("PR3", isrc.getRegistrant()); Assert.assertEquals(73, isrc.getYear()); Assert.assertEquals(12, isrc.getNumber()); Assert.assertEquals("USPR37300012", isrc.toString()); }
@Test(expected = IllegalArgumentException.class) public void testInvalidRegistrant() { InternationalStandardRecordingCode isrc = InternationalStandardRecordingCode.createFromString("USS1Z7300012"); }
@Test(expected = IllegalArgumentException.class) public void testInvalidIsrcWithHyphens() { InternationalStandardRecordingCode isrc = InternationalStandardRecordingCode.createFromString("US-S1Z-73-00012"); }