@Test
public void test_update_getUpdateGet() {
Instant now = Instant.now(_cfgMaster.getClock());
UniqueId uniqueId = UniqueId.of("DbCfg", "101", "0");
ConfigDocument base = _cfgMaster.get(uniqueId);
ConfigItem<ExternalId> input = ConfigItem.of(ExternalId.of("A", "B"));
input.setName("NewName");
ConfigDocument doc = new ConfigDocument(input);
doc.setUniqueId(uniqueId);
ConfigDocument updated = _cfgMaster.update(doc);
assertEquals(false, base.getUniqueId().equals(updated.getUniqueId()));
assertEquals(now, updated.getVersionFromInstant());
assertEquals(null, updated.getVersionToInstant());
assertEquals(now, updated.getCorrectionFromInstant());
assertEquals(null, updated.getCorrectionToInstant());
assertEquals("NewName", updated.getName());
assertEquals(ExternalId.of("A", "B"), updated.getConfig().getValue());
ConfigDocument old = _cfgMaster.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.getName(), old.getName());
assertEquals(base.getConfig().getValue(), old.getConfig().getValue());
ConfigHistoryRequest<ExternalId> search = new ConfigHistoryRequest<ExternalId>(base.getUniqueId(), null, now);
search.setType(ExternalId.class);
ConfigHistoryResult<ExternalId> searchResult = _cfgMaster.history(search);