use of org.finra.herd.model.api.xml.SubjectMatterExpert in project herd by FINRAOS.
the class SubjectMatterExpertServiceImpl method getSubjectMatterExpert.
@Override
public SubjectMatterExpert getSubjectMatterExpert(SubjectMatterExpertKey subjectMatterExpertKey) {
// Validate and trim the subject matter expert key.
validateSubjectMatterExpertKey(subjectMatterExpertKey);
// Get the information for the subject matter expert.
SubjectMatterExpertContactDetails subjectMatterExpertContactDetails = subjectMatterExpertDao.getSubjectMatterExpertByKey(subjectMatterExpertKey);
if (subjectMatterExpertContactDetails == null) {
throw new ObjectNotFoundException(String.format("The subject matter expert with user id \"%s\" does not exist.", subjectMatterExpertKey.getUserId()));
}
// Create and return the subject matter expert.
return new SubjectMatterExpert(subjectMatterExpertKey, subjectMatterExpertContactDetails);
}
use of org.finra.herd.model.api.xml.SubjectMatterExpert in project herd by FINRAOS.
the class SubjectMatterExpertRestControllerTest method testGetSubjectMatterExpert.
@Test
public void testGetSubjectMatterExpert() {
SubjectMatterExpert subjectMatterExpert = new SubjectMatterExpert(new SubjectMatterExpertKey(USER_ID), new SubjectMatterExpertContactDetails(USER_FULL_NAME, USER_JOB_TITLE, USER_EMAIL_ADDRESS, USER_TELEPHONE_NUMBER));
when(subjectMatterExpertService.getSubjectMatterExpert(new SubjectMatterExpertKey(USER_ID))).thenReturn(subjectMatterExpert);
// Get subject matter expert information.
SubjectMatterExpert result = subjectMatterExpertRestController.getSubjectMatterExpert(USER_ID);
// Verify the external calls.
verify(subjectMatterExpertService).getSubjectMatterExpert(new SubjectMatterExpertKey(USER_ID));
verifyNoMoreInteractions(subjectMatterExpertService);
// Validate the returned object.
assertEquals(subjectMatterExpert, result);
}
use of org.finra.herd.model.api.xml.SubjectMatterExpert in project herd by FINRAOS.
the class SubjectMatterExpertServiceTest method testGetSubjectMatterExpertTrimParameters.
@Test
public void testGetSubjectMatterExpertTrimParameters() {
// Get subject matter expert information using input parameters with leading and trailing empty spaces.
SubjectMatterExpert result = subjectMatterExpertService.getSubjectMatterExpert(new SubjectMatterExpertKey(addWhitespace(USER_ID)));
// Validate the returned object.
assertEquals(new SubjectMatterExpert(new SubjectMatterExpertKey(USER_ID), new SubjectMatterExpertContactDetails(USER_FULL_NAME, USER_JOB_TITLE, USER_EMAIL_ADDRESS, USER_TELEPHONE_NUMBER)), result);
}
use of org.finra.herd.model.api.xml.SubjectMatterExpert in project herd by FINRAOS.
the class SubjectMatterExpertServiceTest method testGetSubjectMatterExpert.
@Test
public void testGetSubjectMatterExpert() throws Exception {
// Get subject matter expert information.
SubjectMatterExpert result = subjectMatterExpertService.getSubjectMatterExpert(new SubjectMatterExpertKey(USER_ID));
// Validate the returned object.
assertEquals(new SubjectMatterExpert(new SubjectMatterExpertKey(USER_ID), new SubjectMatterExpertContactDetails(USER_FULL_NAME, USER_JOB_TITLE, USER_EMAIL_ADDRESS, USER_TELEPHONE_NUMBER)), result);
}
Aggregations