test_class.declarator: expectedException = ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException expectedException = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: expectedException
test_class.declarator: securityFunctionDaoHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityFunctionDaoHelper securityFunctionDaoHelper;
test_class.type: SecurityFunctionDaoHelper
test_class.var_name: securityFunctionDaoHelper
test_class.declarator: securityFunctionHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityFunctionHelper securityFunctionHelper;
test_class.type: SecurityFunctionHelper
test_class.var_name: securityFunctionHelper
test_class.declarator: securityRoleDaoHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityRoleDaoHelper securityRoleDaoHelper;
test_class.type: SecurityRoleDaoHelper
test_class.var_name: securityRoleDaoHelper
test_class.declarator: securityRoleFunctionDao
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityRoleFunctionDao securityRoleFunctionDao;
test_class.type: SecurityRoleFunctionDao
test_class.var_name: securityRoleFunctionDao
test_class.declarator: securityRoleFunctionDaoHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityRoleFunctionDaoHelper securityRoleFunctionDaoHelper;
test_class.type: SecurityRoleFunctionDaoHelper
test_class.var_name: securityRoleFunctionDaoHelper
test_class.declarator: securityRoleFunctionHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityRoleFunctionHelper securityRoleFunctionHelper;
test_class.type: SecurityRoleFunctionHelper
test_class.var_name: securityRoleFunctionHelper
test_class.declarator: securityRoleFunctionService
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private SecurityRoleFunctionServiceImpl securityRoleFunctionService;
test_class.type: SecurityRoleFunctionServiceImpl
test_class.var_name: securityRoleFunctionService
test_class.declarator: securityRoleHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityRoleHelper securityRoleHelper;
test_class.type: SecurityRoleHelper
test_class.var_name: securityRoleHelper
test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/impl/SecurityRoleFunctionServiceImplTest.java
test_class.identifier: SecurityRoleFunctionServiceImplTest
test_case.body: @Test
      public void testCreateSecurityRoleFunction()
      {
          // Create a security role to function mapping key.
          SecurityRoleFunctionKey securityRoleFunctionKey = new SecurityRoleFunctionKey(SECURITY_ROLE, SECURITY_FUNCTION);
  
          // Create a security role to function mapping create request.
          SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest = new SecurityRoleFunctionCreateRequest(securityRoleFunctionKey);
  
          // Create a security role entity.
          SecurityRoleEntity securityRoleEntity = new SecurityRoleEntity();
          securityRoleEntity.setCode(SECURITY_ROLE);
  
          // Create a security function entity.
          SecurityFunctionEntity securityFunctionEntity = new SecurityFunctionEntity();
          securityFunctionEntity.setCode(SECURITY_FUNCTION);
  
          // Mock the external calls.
          when(securityRoleFunctionDao.getSecurityRoleFunctionByKey(securityRoleFunctionKey)).thenReturn(null);
          when(securityRoleDaoHelper.getSecurityRoleEntity(SECURITY_ROLE)).thenReturn(securityRoleEntity);
          when(securityFunctionDaoHelper.getSecurityFunctionEntity(SECURITY_FUNCTION)).thenReturn(securityFunctionEntity);
          doAnswer(new Answer<Void>()
          {
              public Void answer(InvocationOnMock invocation)
              {
                  // Get the security role to function mapping entity and set its primary key.
                  SecurityRoleFunctionEntity securityRoleFunctionEntity = (SecurityRoleFunctionEntity) invocation.getArguments()[0];
                  securityRoleFunctionEntity.setId(ID);
                  return null;
              }
          }).when(securityRoleFunctionDao).saveAndRefresh(any(SecurityRoleFunctionEntity.class));
  
          // Call the method under test.
          SecurityRoleFunction result = securityRoleFunctionService.createSecurityRoleFunction(securityRoleFunctionCreateRequest);
  
          // Validate the results.
          assertEquals(new SecurityRoleFunction(result.getId(), securityRoleFunctionKey), result);
  
          // Verify the external calls.
          verify(securityRoleFunctionHelper).validateAndTrimSecurityRoleFunctionCreateRequest(securityRoleFunctionCreateRequest);
          verify(securityRoleFunctionDao).getSecurityRoleFunctionByKey(securityRoleFunctionKey);
          verify(securityRoleDaoHelper).getSecurityRoleEntity(SECURITY_ROLE);
          verify(securityFunctionDaoHelper).getSecurityFunctionEntity(SECURITY_FUNCTION);
          verify(securityRoleFunctionDao).saveAndRefresh(any(SecurityRoleFunctionEntity.class));
          verifyNoMoreInteractionsHelper();
      }
test_case.class_method_signature: SecurityRoleFunctionServiceImplTest.testCreateSecurityRoleFunction()
test_case.full_signature: @Test public void testCreateSecurityRoleFunction()
test_case.identifier: testCreateSecurityRoleFunction
test_case.invocations: setCode setCode thenReturn when getSecurityRoleFunctionByKey thenReturn when getSecurityRoleEntity thenReturn when getSecurityFunctionEntity saveAndRefresh when doAnswer getArguments setId any createSecurityRoleFunction assertEquals getId validateAndTrimSecurityRoleFunctionCreateRequest verify getSecurityRoleFunctionByKey verify getSecurityRoleEntity verify getSecurityFunctionEntity verify saveAndRefresh verify any verifyNoMoreInteractionsHelper
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateSecurityRoleFunction()
focal_class.declarator: securityFunctionDaoHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityFunctionDaoHelper securityFunctionDaoHelper;
focal_class.type: SecurityFunctionDaoHelper
focal_class.var_name: securityFunctionDaoHelper
focal_class.declarator: securityFunctionHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityFunctionHelper securityFunctionHelper;
focal_class.type: SecurityFunctionHelper
focal_class.var_name: securityFunctionHelper
focal_class.declarator: securityRoleDaoHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityRoleDaoHelper securityRoleDaoHelper;
focal_class.type: SecurityRoleDaoHelper
focal_class.var_name: securityRoleDaoHelper
focal_class.declarator: securityRoleFunctionDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityRoleFunctionDao securityRoleFunctionDao;
focal_class.type: SecurityRoleFunctionDao
focal_class.var_name: securityRoleFunctionDao
focal_class.declarator: securityRoleFunctionDaoHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityRoleFunctionDaoHelper securityRoleFunctionDaoHelper;
focal_class.type: SecurityRoleFunctionDaoHelper
focal_class.var_name: securityRoleFunctionDaoHelper
focal_class.declarator: securityRoleFunctionHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityRoleFunctionHelper securityRoleFunctionHelper;
focal_class.type: SecurityRoleFunctionHelper
focal_class.var_name: securityRoleFunctionHelper
focal_class.declarator: securityRoleHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityRoleHelper securityRoleHelper;
focal_class.type: SecurityRoleHelper
focal_class.var_name: securityRoleHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/impl/SecurityRoleFunctionServiceImpl.java
focal_class.identifier: SecurityRoleFunctionServiceImpl
focal_class.interfaces: implements SecurityRoleFunctionService
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.createSecurityRoleFunction(SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
focal_class.full_signature: @Override public SecurityRoleFunction createSecurityRoleFunction(SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
focal_class.identifier: createSecurityRoleFunction
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
focal_class.return: SecurityRoleFunction
focal_class.signature: SecurityRoleFunction createSecurityRoleFunction(SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.deleteSecurityRoleFunction(SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.full_signature: @Override public SecurityRoleFunction deleteSecurityRoleFunction(SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.identifier: deleteSecurityRoleFunction
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.return: SecurityRoleFunction
focal_class.signature: SecurityRoleFunction deleteSecurityRoleFunction(SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.getSecurityRoleFunction(SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.full_signature: @Override public SecurityRoleFunction getSecurityRoleFunction(SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.identifier: getSecurityRoleFunction
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.return: SecurityRoleFunction
focal_class.signature: SecurityRoleFunction getSecurityRoleFunction(SecurityRoleFunctionKey securityRoleFunctionKey)
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.getSecurityRoleFunctions()
focal_class.full_signature: @Override public SecurityRoleFunctionKeys getSecurityRoleFunctions()
focal_class.identifier: getSecurityRoleFunctions
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: SecurityRoleFunctionKeys
focal_class.signature: SecurityRoleFunctionKeys getSecurityRoleFunctions()
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.getSecurityRoleFunctionsBySecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.full_signature: @Override public SecurityRoleFunctionKeys getSecurityRoleFunctionsBySecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.identifier: getSecurityRoleFunctionsBySecurityFunction
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityFunctionKey securityFunctionKey)
focal_class.return: SecurityRoleFunctionKeys
focal_class.signature: SecurityRoleFunctionKeys getSecurityRoleFunctionsBySecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.getSecurityRoleFunctionsBySecurityRole(SecurityRoleKey securityRoleKey)
focal_class.full_signature: @Override public SecurityRoleFunctionKeys getSecurityRoleFunctionsBySecurityRole(SecurityRoleKey securityRoleKey)
focal_class.identifier: getSecurityRoleFunctionsBySecurityRole
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityRoleKey securityRoleKey)
focal_class.return: SecurityRoleFunctionKeys
focal_class.signature: SecurityRoleFunctionKeys getSecurityRoleFunctionsBySecurityRole(SecurityRoleKey securityRoleKey)
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.createSecurityRoleFunctionEntity(SecurityRoleEntity securityRoleEntity, SecurityFunctionEntity securityFunctionEntity)
focal_class.full_signature: private SecurityRoleFunctionEntity createSecurityRoleFunctionEntity(SecurityRoleEntity securityRoleEntity, SecurityFunctionEntity securityFunctionEntity)
focal_class.identifier: createSecurityRoleFunctionEntity
focal_class.modifiers: private
focal_class.parameters: (SecurityRoleEntity securityRoleEntity, SecurityFunctionEntity securityFunctionEntity)
focal_class.return: SecurityRoleFunctionEntity
focal_class.signature: SecurityRoleFunctionEntity createSecurityRoleFunctionEntity(SecurityRoleEntity securityRoleEntity, SecurityFunctionEntity securityFunctionEntity)
focal_class.class_method_signature: SecurityRoleFunctionServiceImpl.createSecurityRoleFunctionFromEntity(SecurityRoleFunctionEntity securityRoleFunctionEntity)
focal_class.full_signature: private SecurityRoleFunction createSecurityRoleFunctionFromEntity(SecurityRoleFunctionEntity securityRoleFunctionEntity)
focal_class.identifier: createSecurityRoleFunctionFromEntity
focal_class.modifiers: private
focal_class.parameters: (SecurityRoleFunctionEntity securityRoleFunctionEntity)
focal_class.return: SecurityRoleFunction
focal_class.signature: SecurityRoleFunction createSecurityRoleFunctionFromEntity(SecurityRoleFunctionEntity securityRoleFunctionEntity)
focal_method.body: @Override
      public SecurityRoleFunction createSecurityRoleFunction(SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
      {
          // Validate and trim the security role to function mapping create request.
          securityRoleFunctionHelper.validateAndTrimSecurityRoleFunctionCreateRequest(securityRoleFunctionCreateRequest);
  
          // Ensure a security role to function mapping with the specified parameters doesn't already exist.
          SecurityRoleFunctionEntity securityRoleFunctionEntity =
              securityRoleFunctionDao.getSecurityRoleFunctionByKey(securityRoleFunctionCreateRequest.getSecurityRoleFunctionKey());
          if (securityRoleFunctionEntity != null)
          {
              throw new AlreadyExistsException(String.format(
                  "Unable to create security role to function mapping for \"%s\" security role name and \"%s\" security function name because it already exists.",
                  securityRoleFunctionCreateRequest.getSecurityRoleFunctionKey().getSecurityRoleName(),
                  securityRoleFunctionCreateRequest.getSecurityRoleFunctionKey().getSecurityFunctionName()));
          }
  
          // Retrieve and ensure that a security role with the specified name exists.
          SecurityRoleEntity securityRoleEntity =
              securityRoleDaoHelper.getSecurityRoleEntity(securityRoleFunctionCreateRequest.getSecurityRoleFunctionKey().getSecurityRoleName());
  
          // Retrieve and ensure that a security function with the specified name exists.
          SecurityFunctionEntity securityFunctionEntity =
              securityFunctionDaoHelper.getSecurityFunctionEntity(securityRoleFunctionCreateRequest.getSecurityRoleFunctionKey().getSecurityFunctionName());
  
          // Creates and persist a security role to function mapping entity.
          securityRoleFunctionEntity = createSecurityRoleFunctionEntity(securityRoleEntity, securityFunctionEntity);
  
          // Persist the new entity.
          securityRoleFunctionDao.saveAndRefresh(securityRoleFunctionEntity);
  
          // Create a security role to function mapping object from the entity and return it.
          return createSecurityRoleFunctionFromEntity(securityRoleFunctionEntity);
      }
focal_method.class_method_signature: SecurityRoleFunctionServiceImpl.createSecurityRoleFunction(SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
focal_method.full_signature: @Override public SecurityRoleFunction createSecurityRoleFunction(SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
focal_method.identifier: createSecurityRoleFunction
focal_method.invocations: validateAndTrimSecurityRoleFunctionCreateRequest getSecurityRoleFunctionByKey getSecurityRoleFunctionKey format getSecurityRoleName getSecurityRoleFunctionKey getSecurityFunctionName getSecurityRoleFunctionKey getSecurityRoleEntity getSecurityRoleName getSecurityRoleFunctionKey getSecurityFunctionEntity getSecurityFunctionName getSecurityRoleFunctionKey createSecurityRoleFunctionEntity saveAndRefresh createSecurityRoleFunctionFromEntity
focal_method.modifiers: @Override public
focal_method.parameters: (SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)
focal_method.return: SecurityRoleFunction
focal_method.signature: SecurityRoleFunction createSecurityRoleFunction(SecurityRoleFunctionCreateRequest securityRoleFunctionCreateRequest)