use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByNameWithDefault_8.
/**
* Storage attribute: blank Default value: null Assert throw
*/
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_8() {
String attributeName = "test";
String attributeValue = BLANK_TEXT;
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());
}
}
use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_10.
/**
* Storage attribute: non-existent Attribute required: false Attribute required if exists: false Assert return null
*/
@Test
public void testGetStorageAttributeIntegerValueByName_10() {
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_1.
/**
* Storage attribute: non-existent Default value: 2345 Assert return default value
*/
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_1() {
String attributeName = "test";
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity();
Integer defaultValue = 2345;
Integer value = storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, defaultValue);
assertEquals(defaultValue, value);
}
use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_1.
/**
* Storage attribute: 1234 Attribute required: false Attribute required if exists: true Assert result = 1234
*/
@Test
public void testGetStorageAttributeIntegerValueByName_1() {
String attributeName = "test";
String attributeValue = "1234";
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
boolean attributeRequired = false;
boolean attributeValueRequiredIfExists = true;
Integer value = storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists);
assertEquals(new Integer(attributeValue), value);
}
use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.
the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_3.
/**
* Storage attribute: 1234 Attribute required: false Attribute required if exists: false Assert result = 1234
*/
@Test
public void testGetStorageAttributeIntegerValueByName_3() {
String attributeName = "test";
String attributeValue = "1234";
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
boolean attributeRequired = false;
boolean attributeValueRequiredIfExists = false;
Integer value = storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists);
assertEquals(new Integer(attributeValue), value);
}
Aggregations