@Test
public void test_correct_getUpdateGet() {
Instant now = Instant.now(_secMaster.getClock());
UniqueId uniqueId = UniqueId.of("DbSec", "101", "0");
SecurityDocument base = _secMaster.get(uniqueId);
ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
SecurityDocument input = new SecurityDocument(security);
SecurityDocument corrected = _secMaster.correct(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(input.getSecurity(), corrected.getSecurity());
SecurityDocument old = _secMaster.get(UniqueId.of("DbSec", "101", "0"));
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.getSecurity(), old.getSecurity());
SecurityHistoryRequest search = new SecurityHistoryRequest(base.getUniqueId(), now, null);
search.setFullDetail(false);
SecurityHistoryResult searchResult = _secMaster.history(search);
assertEquals(2, searchResult.getDocuments().size());