@Test
public void test_update_getUpdateGet() {
Instant now = Instant.now(_posMaster.getClock());
PositionDocument base = _posMaster.get(UniqueId.of("DbPos", "121", "0"));
ManageablePosition pos = new ManageablePosition(BigDecimal.TEN, ExternalId.of("A", "B"));
pos.setUniqueId(UniqueId.of("DbPos", "121", "0"));
PositionDocument input = new PositionDocument(pos);
PositionDocument updated = _posMaster.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.getPosition(), updated.getPosition());
PositionDocument old = _posMaster.get(UniqueId.of("DbPos", "121", "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.getPosition(), old.getPosition());
PositionDocument old2 = _posMaster.get(ObjectId.of("DbPos", "121"), VersionCorrection.of(_version2Instant, _version2Instant));
assertEquals(base.getUniqueId(), old2.getUniqueId());
PositionDocument old3 = _posMaster.get(ObjectId.of("DbPos", "121"), VersionCorrection.of(_version2Instant, now));
assertEquals(base.getUniqueId(), old3.getUniqueId());
// PositionDocument old4 = _posMaster.get(ObjectId.of("DbPos", "121"), VersionCorrection.of(now, _version2Instant));
// assertEquals(base.getUniqueId(), old4.getUniqueId());
PositionHistoryRequest search = new PositionHistoryRequest(base.getUniqueId(), null, now);