@Test public void nameIndexInsideRange() { String artist = optionalExamples.getArtistName(0); Assert.assertEquals("John Coltrane", artist); }
public String getArtistName(int index) { try { Artist artist = getArtist(index); return artist.getName(); } catch (IllegalArgumentException e) { return "unknown"; } }
Artists { public String getArtistName(int index) { try { Artist artist = getArtist(index); return artist.getName(); } catch (IllegalArgumentException e) { return "unknown"; } } }
Artists { public String getArtistName(int index) { try { Artist artist = getArtist(index); return artist.getName(); } catch (IllegalArgumentException e) { return "unknown"; } } Artists(List<Artist> artists); }
Artists { public String getArtistName(int index) { try { Artist artist = getArtist(index); return artist.getName(); } catch (IllegalArgumentException e) { return "unknown"; } } Artists(List<Artist> artists); Artist getArtist(int index); String getArtistName(int index); }
Artists { public String getArtistName(int index) { try { Artist artist = getArtist(index); return artist.getName(); } catch (IllegalArgumentException e) { return "unknown"; } } Artists(List<Artist> artists); Artist getArtist(int index); String getArtistName(int index);  }