use of org.finra.herd.model.jpa.ConfigurationEntity in project herd by FINRAOS.
the class ConfigurationDaoHelperTest method testGetXmlClobPropertyAndUnmarshallToObjectConfigurationValueIsBlank.
@Test
public void testGetXmlClobPropertyAndUnmarshallToObjectConfigurationValueIsBlank() {
// Create a mock configuration entity.
ConfigurationEntity configurationEntity = mock(ConfigurationEntity.class);
when(configurationEntity.getValueClob()).thenReturn(BLANK_TEXT);
// Mock the external calls.
when(configurationDao.getConfigurationByKey(CONFIGURATION_KEY)).thenReturn(configurationEntity);
// Call the method under test.
String result = configurationDaoHelper.getXmlClobPropertyAndUnmarshallToObject(String.class, CONFIGURATION_KEY);
// Verify the external calls.
verify(configurationDao).getConfigurationByKey(CONFIGURATION_KEY);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertNull(result);
}
use of org.finra.herd.model.jpa.ConfigurationEntity in project herd by FINRAOS.
the class ConfigurationDaoHelperTest method testCheckNotAllowedMethod.
@Test
public void testCheckNotAllowedMethod() {
// Create a list of methods to be blocked.
String blockedMethodListAsText = STRING_VALUE;
List<String> blockedMethods = Arrays.asList(METHOD_NAME);
// Create a mock configuration entity.
ConfigurationEntity configurationEntity = mock(ConfigurationEntity.class);
when(configurationEntity.getValueClob()).thenReturn(blockedMethodListAsText);
// Mock the external calls.
when(configurationDao.getConfigurationByKey(ConfigurationValue.NOT_ALLOWED_HERD_ENDPOINTS.getKey())).thenReturn(configurationEntity);
when(herdStringHelper.splitStringWithDefaultDelimiter(blockedMethodListAsText)).thenReturn(blockedMethods);
// Try to call the method under test.
try {
configurationDaoHelper.checkNotAllowedMethod(METHOD_NAME);
fail();
} catch (MethodNotAllowedException e) {
assertEquals("The requested method is not allowed.", e.getMessage());
}
// Verify the external calls.
verify(configurationDao).getConfigurationByKey(ConfigurationValue.NOT_ALLOWED_HERD_ENDPOINTS.getKey());
verify(herdStringHelper).splitStringWithDefaultDelimiter(blockedMethodListAsText);
verifyNoMoreInteractionsHelper();
}
Aggregations