StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey);
StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey);
@Test public void testGetStorageUnitEntityByKeyStorageUnitNoExists() { // Create a storage unit key. BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME); // Mock the external calls. when(storageUnitDao.getStorageUnitByKey(businessObjectDataStorageUnitKey)).thenReturn(null); // Try to call the method under test. try { storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey); fail(); } catch (ObjectNotFoundException e) { assertEquals(String.format( "Business object data storage unit {namespace: \"%s\", businessObjectDefinitionName: \"%s\", businessObjectFormatUsage: \"%s\", " + "businessObjectFormatFileType: \"%s\", businessObjectFormatVersion: %d, businessObjectDataPartitionValue: \"%s\", " + "businessObjectDataSubPartitionValues: \"%s,%s,%s,%s\", businessObjectDataVersion: %d, storageName: \"%s\"} doesn't exist.", BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3), DATA_VERSION, STORAGE_NAME), e.getMessage()); } // Verify the external calls. verify(storageUnitDao).getStorageUnitByKey(businessObjectDataStorageUnitKey); verifyNoMoreInteractionsHelper(); }
StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey);
@Test public void testGetStorageUnitEntityByKey() { // Create a storage unit key. BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME); // Create a storage unit entity. StorageUnitEntity storageUnitEntity = new StorageUnitEntity(); // Mock the external calls. when(storageUnitDao.getStorageUnitByKey(businessObjectDataStorageUnitKey)).thenReturn(storageUnitEntity); // Call the method under test. StorageUnitEntity result = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey); // Validate the results. assertEquals(storageUnitEntity, result); // Verify the external calls. verify(storageUnitDao).getStorageUnitByKey(businessObjectDataStorageUnitKey); verifyNoMoreInteractionsHelper(); }
when(storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey)).thenReturn(storageUnitEntity); verify(storageUnitDaoHelper).getStorageUnitEntityByKey(businessObjectDataStorageUnitKey); verify(storageUnitDao).saveAndRefresh(storageUnitEntity); verify(jsonHelper).objectToJson(businessObjectDataStorageUnitKey);
when(storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey)).thenReturn(storageUnitEntity); verify(storageUnitDaoHelper).getStorageUnitEntityByKey(businessObjectDataStorageUnitKey); verify(storageUnitDao).saveAndRefresh(storageUnitEntity); verify(jsonHelper).objectToJson(businessObjectDataStorageUnitKey);
StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(storageUnitKey);
StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(storageUnitKey);
when(storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey)).thenReturn(storageUnitEntity); when(storageUnitStatusDaoHelper.getStorageUnitStatusEntity(STORAGE_UNIT_STATUS_2)).thenReturn(storageUnitStatusEntity); doAnswer(new Answer<Void>() verify(storageUnitDaoHelper).getStorageUnitEntityByKey(businessObjectDataStorageUnitKey); verify(storageUnitStatusDaoHelper).getStorageUnitStatusEntity(STORAGE_UNIT_STATUS_2); verify(storageUnitDaoHelper).updateStorageUnitStatus(storageUnitEntity, storageUnitStatusEntity, STORAGE_UNIT_STATUS_2);
StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey);
StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey);