DiskStoreManager extends CacheConfigurationManager<DiskStore> { @Override public void delete(DiskStore config, CacheConfig existing) { existing.getDiskStores().stream() .filter(diskStoreType -> config.getName().equals(diskStoreType.getName())).findFirst() .ifPresent(diskStore -> existing.getDiskStores().remove(diskStore)); } DiskStoreManager(ConfigurationPersistenceService service); @Override void add(DiskStore config, CacheConfig existing); @Override void update(DiskStore config, CacheConfig existing); @Override void delete(DiskStore config, CacheConfig existing); @Override List<DiskStore> list(DiskStore filterConfig, CacheConfig existing); @Override DiskStore get(DiskStore config, CacheConfig existing);  }
@Test public void deleteWhenDiskStoreTypeDoesNotExistShouldNotFail() { manager.delete(diskStore, cacheConfig); assertThat(cacheConfig.getDiskStores().size()).isEqualTo(0); }