### Question:
SongsRepository { public void storeSong(final Song song) { final DynamoDBSongItem dynamoDBSongItem = DynamoDBSongItem.fromSong(song); final DynamoDBSaveExpression dynamoDBSaveExpression = getSongIdDoesNotExistExpression(); try { dynamoDBMapper.save(dynamoDBSongItem, dynamoDBSaveExpression); } catch (ConditionalCheckFailedException e) { throw new SongIdentifierExistsException(song.getId()); } } SongsRepository(final DynamoDBMapper dynamoDBMapper); Optional<Song> getSong(final String songIdentifier); void storeSong(final Song song);  }### Answer:
@Test public void whenNoOtherSongExistsWithSameId_RepositoryStoresSuccessfullyTheSong() { Song songToStore = new Song(SONG_ID, AUTHOR_ID, new Date(SONG_RELEASE_DATE), SONG_DURATION_IN_SECONDS, SONG_ARTIFACT_URI); songsRepository.storeSong(songToStore); }
@Test(expected = SongIdentifierExistsException.class) public void whenOtherSongExistsWithSameId_RepositoryThrowsException() { Song songToStore = new Song(SONG_ID, AUTHOR_ID, new Date(SONG_RELEASE_DATE), SONG_DURATION_IN_SECONDS, SONG_ARTIFACT_URI); doThrow(ConditionalCheckFailedException.class) .when(mockDynamoDBMapper).save(any(DynamoDBSongItem.class), any(DynamoDBSaveExpression.class)); songsRepository.storeSong(songToStore); }