use of org.finra.herd.model.api.xml.SubjectMatterExpertKey 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.SubjectMatterExpertKey in project herd by FINRAOS.
the class SubjectMatterExpertServiceTest method testGetSubjectMatterExpertMissingRequiredParameters.
@Test
public void testGetSubjectMatterExpertMissingRequiredParameters() {
// Try to get subject matter expert information when subject matter expert user id is not specified.
try {
subjectMatterExpertService.getSubjectMatterExpert(new SubjectMatterExpertKey(BLANK_TEXT));
fail();
} catch (IllegalArgumentException e) {
assertEquals("A user id must be specified.", e.getMessage());
}
}
use of org.finra.herd.model.api.xml.SubjectMatterExpertKey in project herd by FINRAOS.
the class SubjectMatterExpertDaoTest method testGetSubjectMatterExpertByKey.
@Test
public void testGetSubjectMatterExpertByKey() {
// Get contact details for the subject matter expert.
assertEquals(new SubjectMatterExpertContactDetails(USER_FULL_NAME, USER_JOB_TITLE, USER_EMAIL_ADDRESS, USER_TELEPHONE_NUMBER), subjectMatterExpertDao.getSubjectMatterExpertByKey(new SubjectMatterExpertKey(USER_ID)));
// Get contact details for the subject matter expert without a phone number attribute.
assertEquals(new SubjectMatterExpertContactDetails(USER_FULL_NAME, USER_JOB_TITLE, USER_EMAIL_ADDRESS, NO_USER_TELEPHONE_NUMBER), subjectMatterExpertDao.getSubjectMatterExpertByKey(new SubjectMatterExpertKey(MockLdapOperations.MOCK_USER_ID_ATTRIBUTE_USER_TELEPHONE_NUMBER_NO_EXISTS)));
// Try to get contact details for the subject matter expert that does not exist.
assertNull(subjectMatterExpertDao.getSubjectMatterExpertByKey(new SubjectMatterExpertKey(MockLdapOperations.MOCK_USER_ID_USER_NO_EXISTS)));
}
use of org.finra.herd.model.api.xml.SubjectMatterExpertKey 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.SubjectMatterExpertKey in project herd by FINRAOS.
the class SubjectMatterExpertServiceTest method testGetSubjectMatterExpertUserNoExists.
@Test
public void testGetSubjectMatterExpertUserNoExists() {
// Try to get subject matter expert information when user does not exist.
try {
subjectMatterExpertService.getSubjectMatterExpert(new SubjectMatterExpertKey(MockLdapOperations.MOCK_USER_ID_USER_NO_EXISTS));
fail();
} catch (ObjectNotFoundException e) {
assertEquals(String.format("The subject matter expert with user id \"%s\" does not exist.", MockLdapOperations.MOCK_USER_ID_USER_NO_EXISTS), e.getMessage());
}
}
Aggregations