OrientKeyStoreStorageManager extends StateGuardLifecycleSupport implements KeyStoreStorageManager { @Guarded(by = STARTED) @Nullable public OrientKeyStoreData load(final String keyStoreName) { checkNotNull(keyStoreName); return inTx(databaseInstance).call(db -> entityAdapter.load(db, keyStoreName)); } @Inject  OrientKeyStoreStorageManager(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance,
                                    final OrientKeyStoreDataEntityAdapter entityAdapter,
                                    final EventManager eventManager); @Override @Guarded(by = STARTED) KeyStoreStorage createStorage(final String keyStoreName); @Guarded(by = STARTED) @Nullable OrientKeyStoreData load(final String keyStoreName); @Guarded(by = STARTED) void save(final OrientKeyStoreData entity);  }
@Test public void testLoad_NonExistentData() { assertThat(storageManager.load(KEY_STORE_NAME), is(nullValue())); verify(entityAdapter).load(tx, KEY_STORE_NAME); }
@Test public void testLoad_ExistentData() { OrientKeyStoreData entity = new OrientKeyStoreData(); when(entityAdapter.load(tx, KEY_STORE_NAME)).thenReturn(entity); assertThat(storageManager.load(KEY_STORE_NAME), is(entity)); }