@Test
public void test_update_getUpdateGet() {
Instant now = Instant.now(_holMaster.getClock());
UniqueId uniqueId = UniqueId.of("DbHol", "101", "0");
HolidayDocument base = _holMaster.get(uniqueId);
ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
holiday.setUniqueId(uniqueId);
HolidayDocument input = new HolidayDocument(holiday);
HolidayDocument updated = _holMaster.update(input);
assertEquals(false, base.getUniqueId().equals(updated.getUniqueId()));
assertEquals(now, updated.getVersionFromInstant());
assertEquals(null, updated.getVersionToInstant());
assertEquals(now, updated.getCorrectionFromInstant());
assertEquals(null, updated.getCorrectionToInstant());
assertEquals(input.getHoliday(), updated.getHoliday());
HolidayDocument old = _holMaster.get(uniqueId);
assertEquals(base.getUniqueId(), old.getUniqueId());
assertEquals(base.getVersionFromInstant(), old.getVersionFromInstant());
assertEquals(now, old.getVersionToInstant()); // old version ended
assertEquals(base.getCorrectionFromInstant(), old.getCorrectionFromInstant());
assertEquals(base.getCorrectionToInstant(), old.getCorrectionToInstant());
assertEquals(base.getHoliday(), old.getHoliday());
HolidayHistoryRequest search = new HolidayHistoryRequest(base.getUniqueId(), null, now);
HolidayHistoryResult searchResult = _holMaster.history(search);
assertEquals(2, searchResult.getDocuments().size());
}