@Test(expected = IllegalArgumentException.class) public void indexOutsideRange() { optionalExamples.getArtist(4); }
public Artist getArtist(int index) { if (index < 0 || index >= artists.size()) { indexException(index); } return artists.get(index); }
Artists { public Artist getArtist(int index) { if (index < 0 || index >= artists.size()) { indexException(index); } return artists.get(index); } }
Artists { public Artist getArtist(int index) { if (index < 0 || index >= artists.size()) { indexException(index); } return artists.get(index); } Artists(List<Artist> artists); }
Artists { public Artist getArtist(int index) { if (index < 0 || index >= artists.size()) { indexException(index); } return artists.get(index); } Artists(List<Artist> artists); Artist getArtist(int index); String getArtistName(int index); }
Artists { public Artist getArtist(int index) { if (index < 0 || index >= artists.size()) { indexException(index); } return artists.get(index); } Artists(List<Artist> artists); Artist getArtist(int index); String getArtistName(int index);  }