### Question:
RemoteMusicDatabaseServiceMusicBrainz implements
        RemoteMusicDatabaseService { public StringBuffer appendDate(Date startDate, Date endDate, StringBuffer stringBuffer) { if (startDate == null && endDate == null) { return stringBuffer; } stringBuffer.append(SEARCH_DATE_BASE); if (startDate != null) { stringBuffer.append(dateFormat.format(startDate)); } else { stringBuffer.append("0"); } stringBuffer.append(SEARCH_DATE_TO); if (endDate != null) { stringBuffer.append(dateFormat.format(endDate)); } else { stringBuffer.append(SEARCH_DATE_OPEN_END); } stringBuffer.append(SEARCH_DATE_FINAL); return stringBuffer; } @Inject  RemoteMusicDatabaseServiceMusicBrainz(
            @ApplicationName String appName,
            @ApplicationVersion String appVersion,
            @ApplicationContact String appContact); @Override Artist findReleases(Artist artist, Date fromDate, Date endDate); StringBuffer appendDate(Date startDate, Date endDate,
            StringBuffer stringBuffer);  }### Answer:
@Test public void testAppendDate() { StringBuffer actual = new StringBuffer(); remoteMusicDatabaseServiceMusicBrainz.appendDate(null, expectedToDate, actual); assertEquals("Unexpected result for open start date", EXPECTED_STRING_OPEN_BEGINNING, actual.toString()); actual = new StringBuffer(); remoteMusicDatabaseServiceMusicBrainz.appendDate(expectedFromDate, null, actual); assertEquals("Unexpected result for open end date", EXPECTED_STRING_OPEN_END, actual.toString()); actual = new StringBuffer(); remoteMusicDatabaseServiceMusicBrainz.appendDate(null, null, actual); assertEquals("Unexpected result for open end date", EXPECTED_STRING_NO_DATES, actual.toString()); actual = new StringBuffer(); remoteMusicDatabaseServiceMusicBrainz.appendDate(expectedFromDate, expectedToDate, actual); assertEquals("Unexpected result for open end date", EXPECTED_STRING_REGULAR_DATES, actual.toString()); }