@Test
public void test_correct_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.setUniqueId(uniqueId);
input.setName("NewName");
ConfigDocument corrected = _cfgMaster.correct(new ConfigDocument(input));
assertEquals(false, base.getUniqueId().equals(corrected.getUniqueId()));
assertEquals(base.getVersionFromInstant(), corrected.getVersionFromInstant());
assertEquals(base.getVersionToInstant(), corrected.getVersionToInstant());
assertEquals(now, corrected.getCorrectionFromInstant());
assertEquals(null, corrected.getCorrectionToInstant());
assertEquals("NewName", corrected.getName());
assertEquals(ExternalId.of("A", "B"), corrected.getConfig().getValue());
ConfigDocument old = _cfgMaster.get(uniqueId);
assertEquals(base.getUniqueId(), old.getUniqueId());
assertEquals(base.getVersionFromInstant(), old.getVersionFromInstant());
assertEquals(base.getVersionToInstant(), old.getVersionToInstant());
assertEquals(base.getCorrectionFromInstant(), old.getCorrectionFromInstant());
assertEquals(now, old.getCorrectionToInstant()); // old version ended
assertEquals(base.getConfig().getValue(), old.getConfig().getValue());
ConfigHistoryRequest<ExternalId> search = new ConfigHistoryRequest<ExternalId>(base.getUniqueId(), now, null);
search.setType(ExternalId.class);
ConfigHistoryResult<ExternalId> searchResult = _cfgMaster.history(search);