StorageUnitDaoHelper { public StorageUnitEntity getStorageUnitEntityByBusinessObjectDataAndStorage(BusinessObjectDataEntity businessObjectDataEntity, StorageEntity storageEntity) { StorageUnitEntity storageUnitEntity = storageUnitDao.getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity); if (storageUnitEntity == null) { throw new ObjectNotFoundException(String .format("Could not find storage unit in \"%s\" storage for the business object data {%s}.", storageEntity.getName(), businessObjectDataHelper.businessObjectDataEntityAltKeyToString(businessObjectDataEntity))); } return storageUnitEntity; }  StorageUnitEntity findExplicitlyRegisteredSubPartitionInStorageForBusinessObjectData(StorageEntity storageEntity,
        BusinessObjectFormatEntity businessObjectFormatEntity, BusinessObjectFormat businessObjectFormat, BusinessObjectDataKey businessObjectDataKey); StorageUnitEntity getStorageUnitEntity(String storageName, BusinessObjectDataEntity businessObjectDataEntity); StorageUnitEntity getStorageUnitEntityByBusinessObjectDataAndStorage(BusinessObjectDataEntity businessObjectDataEntity, StorageEntity storageEntity); StorageUnitEntity getStorageUnitEntityByKey(BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey); void setStorageUnitStatus(StorageUnitEntity storageUnitEntity, StorageUnitStatusEntity storageUnitStatusEntity); void updateStorageUnitStatus(StorageUnitEntity storageUnitEntity, String storageUnitStatus, String reason); void updateStorageUnitStatus(StorageUnitEntity storageUnitEntity, StorageUnitStatusEntity storageUnitStatusEntity, String reason); void validateNoExplicitlyRegisteredSubPartitionInStorageForBusinessObjectData(StorageEntity storageEntity,
        BusinessObjectFormatEntity businessObjectFormatEntity, BusinessObjectDataKey businessObjectDataKey, String s3KeyPrefix);  }
@Test public void testGetStorageUnitEntityByBusinessObjectDataAndStorage() { BusinessObjectDataEntity businessObjectDataEntity = new BusinessObjectDataEntity(); StorageEntity storageEntity = new StorageEntity(); StorageUnitEntity storageUnitEntity = new StorageUnitEntity(); when(storageUnitDao.getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity)).thenReturn(storageUnitEntity); StorageUnitEntity result = storageUnitDaoHelper.getStorageUnitEntityByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity); assertEquals(storageUnitEntity, result); verify(storageUnitDao).getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity); verifyNoMoreInteractionsHelper(); }
@Test public void testGetStorageUnitEntityByBusinessObjectDataAndStorageStorageUnitNoExists() { BusinessObjectDataEntity businessObjectDataEntity = new BusinessObjectDataEntity(); StorageEntity storageEntity = new StorageEntity(); storageEntity.setName(STORAGE_NAME); when(storageUnitDao.getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity)).thenReturn(null); when(businessObjectDataHelper.businessObjectDataEntityAltKeyToString(businessObjectDataEntity)).thenReturn(BUSINESS_OBJECT_DATA_KEY_AS_STRING); try { storageUnitDaoHelper.getStorageUnitEntityByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity); fail(); } catch (ObjectNotFoundException e) { assertEquals(String .format("Could not find storage unit in \"%s\" storage for the business object data {%s}.", STORAGE_NAME, BUSINESS_OBJECT_DATA_KEY_AS_STRING), e.getMessage()); } verify(storageUnitDao).getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity); verify(businessObjectDataHelper).businessObjectDataEntityAltKeyToString(businessObjectDataEntity); verifyNoMoreInteractionsHelper(); }