@Test
public void test_update_getUpdateGet() {
Instant now = Instant.now(_htsMaster.getClock());
HistoricalTimeSeriesInfoDocument base = _htsMaster.get(UniqueId.of("DbHts", "101", "0"));
ManageableHistoricalTimeSeriesInfo info = new ManageableHistoricalTimeSeriesInfo();
info.setUniqueId(UniqueId.of("DbHts", "101", "0"));
info.setName("Updated");
info.setDataField("DF");
info.setDataSource("DS");
info.setDataProvider("DP");
info.setObservationTime("OT");
ExternalIdWithDates id = ExternalIdWithDates.of(ExternalId.of("A", "B"), LocalDate.of(2011, 6, 30), null);
ExternalIdBundleWithDates bundle = ExternalIdBundleWithDates.of(id);
info.setExternalIdBundle(bundle);
HistoricalTimeSeriesInfoDocument input = new HistoricalTimeSeriesInfoDocument(info);
HistoricalTimeSeriesInfoDocument updated = _htsMaster.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.getInfo(), updated.getInfo());
HistoricalTimeSeriesInfoDocument old = _htsMaster.get(UniqueId.of("DbHts", "101", "0"));
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.getInfo(), old.getInfo());
HistoricalTimeSeriesInfoHistoryRequest search = new HistoricalTimeSeriesInfoHistoryRequest(base.getUniqueId(), null, now);
HistoricalTimeSeriesInfoHistoryResult searchResult = _htsMaster.history(search);
assertEquals(2, searchResult.getDocuments().size());
}