DBInstanceImpl implements DBInstance { @Override public void removeBag(String bagName) throws JasDBStorageException { try { storageServiceFactory.removeStorageService(instanceMeta.getInstanceId(), bagName); } catch(ConfigurationException e) { throw new JasDBStorageException("Unable to remove bag", e); } } DBInstanceImpl(StorageServiceFactory storageServiceFactory, MetadataStore metadataStore, Instance instanceMeta); @Override String getInstanceId(); @Override List<Bag> getBags(); @Override Bag getBag(String bagName); @Override void removeBag(String bagName); @Override String getPath();  }
@Test public void testRemoveBag() throws JasDBStorageException { when(instanceMeta.getInstanceId()).thenReturn("instance1"); DBInstance dbInstance = new DBInstanceImpl(storageServiceFactory, metadataStore, instanceMeta); dbInstance.removeBag("bag"); verify(storageServiceFactory, times(1)).removeStorageService("instance1", "bag"); }