@Test
public void test_update_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 updated = _secMaster.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.getSecurity(), updated.getSecurity());
SecurityDocument old = _secMaster.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.getSecurity(), old.getSecurity());
SecurityHistoryRequest search = new SecurityHistoryRequest(base.getUniqueId(), null, now);
search.setFullDetail(false);
SecurityHistoryResult searchResult = _secMaster.history(search);
assertEquals(2, searchResult.getDocuments().size());