use of org.finra.herd.model.api.xml.DataProviderCreateRequest in project herd by FINRAOS.
the class DataProviderRestControllerTest method testCreateDataProvider.
@Test
public void testCreateDataProvider() throws Exception {
DataProviderCreateRequest dataProviderCreateRequest = new DataProviderCreateRequest(DATA_PROVIDER_NAME);
// Create a data provider.
DataProvider dataProvider = new DataProvider(DATA_PROVIDER_NAME);
when(dataProviderService.createDataProvider(dataProviderCreateRequest)).thenReturn(dataProvider);
DataProvider resultDataProvider = dataProviderRestController.createDataProvider(new DataProviderCreateRequest(DATA_PROVIDER_NAME));
// Validate the returned object.
assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider);
// Verify the external calls.
verify(dataProviderService).createDataProvider(dataProviderCreateRequest);
verifyNoMoreInteractions(dataProviderService);
// Validate the returned object.
assertEquals(dataProvider, resultDataProvider);
}
use of org.finra.herd.model.api.xml.DataProviderCreateRequest in project herd by FINRAOS.
the class DataProviderServiceTest method testCreateDataProviderMissingRequiredParameters.
@Test
public void testCreateDataProviderMissingRequiredParameters() {
// Try to create a data provider instance when data provider name is not specified.
try {
dataProviderService.createDataProvider(new DataProviderCreateRequest(BLANK_TEXT));
fail("Should throw an IllegalArgumentException when data provider name is not specified.");
} catch (IllegalArgumentException e) {
assertEquals("A data provider name must be specified.", e.getMessage());
}
}
use of org.finra.herd.model.api.xml.DataProviderCreateRequest in project herd by FINRAOS.
the class DataProviderServiceTest method testCreateDataProviderUpperCaseParameters.
@Test
public void testCreateDataProviderUpperCaseParameters() {
// Create a data provider using upper case input parameters.
DataProvider resultDataProvider = dataProviderService.createDataProvider(new DataProviderCreateRequest(DATA_PROVIDER_NAME.toUpperCase()));
// Validate the returned object.
assertEquals(new DataProvider(DATA_PROVIDER_NAME.toUpperCase()), resultDataProvider);
}
use of org.finra.herd.model.api.xml.DataProviderCreateRequest in project herd by FINRAOS.
the class DataProviderServiceTest method testCreateDataProviderInvalidParameters.
@Test
public void testCreateDataProviderInvalidParameters() {
// Try to create a data provider instance when data provider name contains a forward slash character.
try {
dataProviderService.createDataProvider(new DataProviderCreateRequest(addSlash(DATA_PROVIDER_NAME)));
fail("Should throw an IllegalArgumentException when data provider name contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Data provider name can not contain a forward slash character.", e.getMessage());
}
}
use of org.finra.herd.model.api.xml.DataProviderCreateRequest in project herd by FINRAOS.
the class DataProviderServiceTest method testCreateDataProvider.
@Test
public void testCreateDataProvider() throws Exception {
// Create a data provider.
DataProvider resultDataProvider = dataProviderService.createDataProvider(new DataProviderCreateRequest(DATA_PROVIDER_NAME));
// Validate the returned object.
assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider);
}
Aggregations