InMemorySecurityMaster extends SimpleAbstractInMemoryMaster<SecurityDocument> implements SecurityMaster { @Override public SecurityDocument update(final SecurityDocument document) { ArgumentChecker.notNull(document, "document"); ArgumentChecker.notNull(document.getUniqueId(), "document.uniqueId"); ArgumentChecker.notNull(document.getSecurity(), "document.security"); final UniqueId uniqueId = document.getUniqueId(); final Instant now = Instant.now(); final SecurityDocument storedDocument = _store.get(uniqueId.getObjectId()); if (storedDocument == null) { throw new DataNotFoundException("Security 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, uniqueId.getObjectId(), storedDocument.getVersionFromInstant(), document.getVersionToInstant(), now); _externalIdCache.remove(storedDocument.getSecurity()); _externalIdCache.add(document.getSecurity(), document); return document; } InMemorySecurityMaster();  InMemorySecurityMaster(final ChangeManager changeManager);  InMemorySecurityMaster(final Supplier<ObjectId> objectIdSupplier);  InMemorySecurityMaster(final Supplier<ObjectId> objectIdSupplier, final ChangeManager changeManager); @Override SecurityMetaDataResult metaData(final SecurityMetaDataRequest request); @Override SecuritySearchResult search(final SecuritySearchRequest request); @Override SecurityDocument get(final UniqueId uniqueId); @Override SecurityDocument get(final ObjectIdentifiable objectId, final VersionCorrection versionCorrection); @Override SecurityDocument add(final SecurityDocument document); @Override SecurityDocument update(final SecurityDocument document); @Override void remove(final ObjectIdentifiable objectIdentifiable); @Override SecurityDocument correct(final SecurityDocument document); @Override SecurityHistoryResult history(final SecurityHistoryRequest request); static final String DEFAULT_OID_SCHEME; }
@Test(expectedExceptions = DataNotFoundException.class) public void test_update_emptyMaster() { SecurityDocument doc = new SecurityDocument(); doc.setSecurity(SEC1); doc.setUniqueId(OTHER_UID); testEmpty.update(doc); }