InMemorySnapshotMaster extends SimpleAbstractInMemoryMaster<MarketDataSnapshotDocument> implements MarketDataSnapshotMaster { @Override public MarketDataSnapshotDocument update(final MarketDataSnapshotDocument document) { ArgumentChecker.notNull(document, "document"); ArgumentChecker.notNull(document.getUniqueId(), "document.uniqueId"); ArgumentChecker.notNull(document.getSnapshot(), "document.snapshot"); final UniqueId uniqueId = document.getUniqueId(); validateUniqueId(uniqueId); final Instant now = Instant.now(); final MarketDataSnapshotDocument storedDocument = _store.get(uniqueId.getObjectId()); if (storedDocument == null) { throw new DataNotFoundException("Snapshot not found: " + uniqueId); } document.setVersionFromInstant(now); document.setVersionToInstant(null); document.setCorrectionFromInstant(now); document.setCorrectionToInstant(null); if (_store.replace(uniqueId.getObjectId(), storedDocument, document) == false) { throw new IllegalArgumentException("Concurrent modification"); } _changeManager.entityChanged(ChangeType.CHANGED, document.getObjectId(), document.getVersionFromInstant(), document.getVersionToInstant(), now); return document; } InMemorySnapshotMaster();  InMemorySnapshotMaster(final ChangeManager changeManager);  InMemorySnapshotMaster(final Supplier<ObjectId> objectIdSupplier);  InMemorySnapshotMaster(final Supplier<ObjectId> objectIdSupplier, final ChangeManager changeManager); @Override MarketDataSnapshotSearchResult search(final MarketDataSnapshotSearchRequest request); @Override MarketDataSnapshotDocument get(final UniqueId uniqueId); @Override MarketDataSnapshotDocument get(final ObjectIdentifiable objectId, final VersionCorrection versionCorrection); @Override MarketDataSnapshotDocument add(final MarketDataSnapshotDocument document); @Override MarketDataSnapshotDocument update(final MarketDataSnapshotDocument document); @Override void remove(ObjectIdentifiable objectIdentifiable); @Override MarketDataSnapshotDocument correct(final MarketDataSnapshotDocument document); @Override MarketDataSnapshotHistoryResult history(final MarketDataSnapshotHistoryRequest request); static final String DEFAULT_OID_SCHEME; }
@Test(expectedExceptions = DataNotFoundException.class) public void test_update_emptyMaster() { MarketDataSnapshotDocument doc = new MarketDataSnapshotDocument(); doc.setSnapshot(SNAP1); doc.setUniqueId(OTHER_UID); _testEmpty.update(doc); }