@Test
  public void biographyAndImageUrlAreReturnedAsInfo() throws ApplicationException {
    deleteArtistInfos();

    int abbaId = musicDao.getArtistId(aiAbba.getArtist());

    dao.createArtistInfo(Arrays.asList(aiAbba));
    ArtistInfo dbAbba = dao.getArtistInfo(abbaId);

    Assert.assertEquals(ABBA_IMAGE_URL, dbAbba.getLargeImageUrl());
    Assert.assertEquals(ABBA_BIO_SUMMARY, dbAbba.getBioSummary());
  }
  @Test
  public void bioSummaryCanBeUpdated() {
    deleteArtistInfos();

    int abbaId = musicDao.getArtistId(aiAbba.getArtist());

    String biography = "new ABBA biography";

    dao.createArtistInfo(Arrays.asList(aiAbba));
    dao.setBioSummary(abbaId, biography);

    ArtistInfo dbAbba = dao.getArtistInfo(abbaId);

    Assert.assertEquals(biography, dbAbba.getBioSummary());
  }
  @Test
  public void createAndValidateArtistInfos() throws ApplicationException {
    deleteArtistInfos();

    List<ArtistInfo> artistInfos = new ArrayList<>();
    artistInfos.add(aiAbba);
    artistInfos.add(aiCher);

    dao.createArtistInfo(artistInfos);

    ArtistInfo dbAbba = dao.getArtistInfo(aiAbba.getArtist());
    ArtistInfo dbCher = dao.getArtistInfo(aiCher.getArtist());

    Assert.assertEquals(aiAbba, dbAbba);
    Assert.assertEquals(aiCher, dbCher);
  }
  @Test
  public void createAndValidateUpdatedArtistInfos() throws ApplicationException {
    deleteArtistInfos();

    String newBio = "Abba was a pop group.";
    String newContent = "Abba was a pop group. They sold many records.";

    dao.createArtistInfo(Arrays.asList(aiAbba, aiTina));

    aiAbba.setBioSummary(newBio);
    aiAbba.setBioContent(newContent);

    dao.createArtistInfo(Arrays.asList(aiAbba, aiCher));

    ArtistInfo dbAbba = dao.getArtistInfo(aiAbba.getArtist());

    Assert.assertEquals(newBio, dbAbba.getBioSummary());
    Assert.assertEquals(newContent, dbAbba.getBioContent());
  }
 private void deleteArtistInfos() {
   dao.getJdbcTemplate().execute("truncate music.artistinfo cascade");
 }