use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_13.
/**
* Storage attribute: null Attribute required: false Attribute required if exists: false Assert return null
*/
@Test
public void testGetStorageAttributeIntegerValueByName_13() {
String attributeName = "test";
String attributeValue = null;
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
boolean attributeRequired = true;
boolean attributeValueRequiredIfExists = false;
assertEquals(attributeValue, storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists));
}
use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_8.
/**
* Storage attribute: non-existent Attribute required: false Attribute required if exists: true Assert return null
*/
@Test
public void testGetStorageAttributeIntegerValueByName_8() {
String attributeName = "test";
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity();
boolean attributeRequired = false;
boolean attributeValueRequiredIfExists = true;
Integer value = storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists);
assertEquals(null, value);
}
use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByNameWithDefault_5.
/**
* Storage attribute: abcd Default value: 2345 Assert throw
*/
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_5() {
String attributeName = "test";
String attributeValue = "abcd";
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
Integer defaultValue = 2345;
try {
storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, defaultValue);
fail();
} catch (Exception e) {
assertEquals(IllegalStateException.class, e.getClass());
assertEquals("Storage attribute \"" + attributeName + "\" must be a valid integer. Actual value is \"" + attributeValue + "\"", e.getMessage());
}
}
use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_7.
/**
* Storage attribute: blank Attribute required: false Attribute required if exists: false Assert throw
*/
@Test
public void testGetStorageAttributeIntegerValueByName_7() {
String attributeName = "test";
String attributeValue = BLANK_TEXT;
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
boolean attributeRequired = false;
boolean attributeValueRequiredIfExists = false;
try {
storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists);
fail();
} catch (Exception e) {
assertEquals(IllegalStateException.class, e.getClass());
assertEquals("Storage attribute \"" + attributeName + "\" must be a valid integer. Actual value is \"" + attributeValue + "\"", e.getMessage());
}
}
use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByNameWithDefault_6.
/**
* Storage attribute: abcd Default value: null Assert throw
*/
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_6() {
String attributeName = "test";
String attributeValue = "abcd";
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
Integer defaultValue = null;
try {
storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, defaultValue);
fail();
} catch (Exception e) {
assertEquals(IllegalStateException.class, e.getClass());
assertEquals("Storage attribute \"" + attributeName + "\" must be a valid integer. Actual value is \"" + attributeValue + "\"", e.getMessage());
}
}
Aggregations