test_class.declarator: SECURITY_FUNCTION_NAME_WITH_EXTRA_SPACES = SECURITY_FUNCTION + "    "
test_class.modifier: private static final
test_class.original_string: private static final String SECURITY_FUNCTION_NAME_WITH_EXTRA_SPACES = SECURITY_FUNCTION + "    ";
test_class.type: String
test_class.var_name: SECURITY_FUNCTION_NAME_WITH_EXTRA_SPACES
test_class.declarator: SECURITY_FUNCTION_CREATE_REQUEST = new SecurityFunctionCreateRequest()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION);
      }}
test_class.modifier: private static final
test_class.original_string: private static final SecurityFunctionCreateRequest SECURITY_FUNCTION_CREATE_REQUEST = new SecurityFunctionCreateRequest()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION);
      }};
test_class.type: SecurityFunctionCreateRequest
test_class.var_name: SECURITY_FUNCTION_CREATE_REQUEST
test_class.declarator: SECURITY_FUNCTION_CREATE_REQUEST_WITH_EXTRA_SPACES_IN_NAME = new SecurityFunctionCreateRequest()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION_NAME_WITH_EXTRA_SPACES);
      }}
test_class.modifier: private static final
test_class.original_string: private static final SecurityFunctionCreateRequest SECURITY_FUNCTION_CREATE_REQUEST_WITH_EXTRA_SPACES_IN_NAME = new SecurityFunctionCreateRequest()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION_NAME_WITH_EXTRA_SPACES);
      }};
test_class.type: SecurityFunctionCreateRequest
test_class.var_name: SECURITY_FUNCTION_CREATE_REQUEST_WITH_EXTRA_SPACES_IN_NAME
test_class.declarator: SECURITY_FUNCTION_KEY = new SecurityFunctionKey()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION);
      }}
test_class.modifier: private static final
test_class.original_string: private static final SecurityFunctionKey SECURITY_FUNCTION_KEY = new SecurityFunctionKey()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION);
      }};
test_class.type: SecurityFunctionKey
test_class.var_name: SECURITY_FUNCTION_KEY
test_class.declarator: SECURITY_FUNCTION_KEY_WITH_EXTRA_SPACES_IN_NAME = new SecurityFunctionKey()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION_NAME_WITH_EXTRA_SPACES);
      }}
test_class.modifier: private static final
test_class.original_string: private static final SecurityFunctionKey SECURITY_FUNCTION_KEY_WITH_EXTRA_SPACES_IN_NAME = new SecurityFunctionKey()
      {{
          setSecurityFunctionName(SECURITY_FUNCTION_NAME_WITH_EXTRA_SPACES);
      }};
test_class.type: SecurityFunctionKey
test_class.var_name: SECURITY_FUNCTION_KEY_WITH_EXTRA_SPACES_IN_NAME
test_class.declarator: SECURITY_FUNCTION_ENTITY = new SecurityFunctionEntity()
      {{
          setCode(SECURITY_FUNCTION);
          setCreatedBy(CREATED_BY);
          setUpdatedBy(CREATED_BY);
          setCreatedOn(new Timestamp(CREATED_ON.getMillisecond()));
      }}
test_class.modifier: private static final
test_class.original_string: private static final SecurityFunctionEntity SECURITY_FUNCTION_ENTITY = new SecurityFunctionEntity()
      {{
          setCode(SECURITY_FUNCTION);
          setCreatedBy(CREATED_BY);
          setUpdatedBy(CREATED_BY);
          setCreatedOn(new Timestamp(CREATED_ON.getMillisecond()));
      }};
test_class.type: SecurityFunctionEntity
test_class.var_name: SECURITY_FUNCTION_ENTITY
test_class.declarator: ALL_SECURITY_FUNCTION_NAMES = Arrays.asList(SECURITY_FUNCTION, SECURITY_FUNCTION_2, SECURITY_FUNCTION_3)
test_class.modifier: private static final
test_class.original_string: private static final List<String> ALL_SECURITY_FUNCTION_NAMES = Arrays.asList(SECURITY_FUNCTION, SECURITY_FUNCTION_2, SECURITY_FUNCTION_3);
test_class.type: List<String>
test_class.var_name: ALL_SECURITY_FUNCTION_NAMES
test_class.declarator: securityFunctionService
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private SecurityFunctionServiceImpl securityFunctionService;
test_class.type: SecurityFunctionServiceImpl
test_class.var_name: securityFunctionService
test_class.declarator: alternateKeyHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AlternateKeyHelper alternateKeyHelper;
test_class.type: AlternateKeyHelper
test_class.var_name: alternateKeyHelper
test_class.declarator: securityFunctionDao
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SecurityFunctionDao securityFunctionDao;
test_class.type: SecurityFunctionDao
test_class.var_name: securityFunctionDao
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: 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.file: herd-code/herd-service/src/test/java/org/finra/herd/service/impl/SecurityFunctionServiceImplTest.java
test_class.identifier: SecurityFunctionServiceImplTest
test_case.body: @Test
      public void testCreateSecurityFunctionAlreadyExists()
      {
          expectedException.expect(AlreadyExistsException.class);
          expectedException.expectMessage(String.format("Unable to create security function \"%s\" because it already exists.", SECURITY_FUNCTION));
  
          when(securityFunctionDao.getSecurityFunctionByName(SECURITY_FUNCTION)).thenReturn(SECURITY_FUNCTION_ENTITY);
          when(alternateKeyHelper.validateStringParameter(anyString(), anyString())).thenReturn(SECURITY_FUNCTION);
          securityFunctionService.createSecurityFunction(SECURITY_FUNCTION_CREATE_REQUEST);
      }
test_case.class_method_signature: SecurityFunctionServiceImplTest.testCreateSecurityFunctionAlreadyExists()
test_case.full_signature: @Test public void testCreateSecurityFunctionAlreadyExists()
test_case.identifier: testCreateSecurityFunctionAlreadyExists
test_case.invocations: expect expectMessage format thenReturn when getSecurityFunctionByName thenReturn when validateStringParameter anyString anyString createSecurityFunction
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateSecurityFunctionAlreadyExists()
focal_class.declarator: alternateKeyHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private AlternateKeyHelper alternateKeyHelper;
focal_class.type: AlternateKeyHelper
focal_class.var_name: alternateKeyHelper
focal_class.declarator: securityFunctionDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityFunctionDao securityFunctionDao;
focal_class.type: SecurityFunctionDao
focal_class.var_name: securityFunctionDao
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.file: herd-code/herd-service/src/main/java/org/finra/herd/service/impl/SecurityFunctionServiceImpl.java
focal_class.identifier: SecurityFunctionServiceImpl
focal_class.interfaces: implements SecurityFunctionService
focal_class.class_method_signature: SecurityFunctionServiceImpl.createSecurityFunction(SecurityFunctionCreateRequest request)
focal_class.full_signature: @Override public SecurityFunction createSecurityFunction(SecurityFunctionCreateRequest request)
focal_class.identifier: createSecurityFunction
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityFunctionCreateRequest request)
focal_class.return: SecurityFunction
focal_class.signature: SecurityFunction createSecurityFunction(SecurityFunctionCreateRequest request)
focal_class.class_method_signature: SecurityFunctionServiceImpl.getSecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.full_signature: @Override public SecurityFunction getSecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.identifier: getSecurityFunction
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityFunctionKey securityFunctionKey)
focal_class.return: SecurityFunction
focal_class.signature: SecurityFunction getSecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.class_method_signature: SecurityFunctionServiceImpl.deleteSecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.full_signature: @Override public SecurityFunction deleteSecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.identifier: deleteSecurityFunction
focal_class.modifiers: @Override public
focal_class.parameters: (SecurityFunctionKey securityFunctionKey)
focal_class.return: SecurityFunction
focal_class.signature: SecurityFunction deleteSecurityFunction(SecurityFunctionKey securityFunctionKey)
focal_class.class_method_signature: SecurityFunctionServiceImpl.getSecurityFunctions()
focal_class.full_signature: @Override public SecurityFunctionKeys getSecurityFunctions()
focal_class.identifier: getSecurityFunctions
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: SecurityFunctionKeys
focal_class.signature: SecurityFunctionKeys getSecurityFunctions()
focal_class.class_method_signature: SecurityFunctionServiceImpl.validateSecurityFunctionCreateRequest(SecurityFunctionCreateRequest request)
focal_class.full_signature:  void validateSecurityFunctionCreateRequest(SecurityFunctionCreateRequest request)
focal_class.identifier: validateSecurityFunctionCreateRequest
focal_class.parameters: (SecurityFunctionCreateRequest request)
focal_class.return: void
focal_class.signature: void validateSecurityFunctionCreateRequest(SecurityFunctionCreateRequest request)
focal_class.class_method_signature: SecurityFunctionServiceImpl.validateAndTrimSecurityFunctionKey(SecurityFunctionKey securityFunctionKey)
focal_class.full_signature:  void validateAndTrimSecurityFunctionKey(SecurityFunctionKey securityFunctionKey)
focal_class.identifier: validateAndTrimSecurityFunctionKey
focal_class.parameters: (SecurityFunctionKey securityFunctionKey)
focal_class.return: void
focal_class.signature: void validateAndTrimSecurityFunctionKey(SecurityFunctionKey securityFunctionKey)
focal_class.class_method_signature: SecurityFunctionServiceImpl.createSecurityFunctionEntity(SecurityFunctionCreateRequest request)
focal_class.full_signature: private SecurityFunctionEntity createSecurityFunctionEntity(SecurityFunctionCreateRequest request)
focal_class.identifier: createSecurityFunctionEntity
focal_class.modifiers: private
focal_class.parameters: (SecurityFunctionCreateRequest request)
focal_class.return: SecurityFunctionEntity
focal_class.signature: SecurityFunctionEntity createSecurityFunctionEntity(SecurityFunctionCreateRequest request)
focal_class.class_method_signature: SecurityFunctionServiceImpl.createSecurityFunctionFromEntity(SecurityFunctionEntity securityFunctionEntity)
focal_class.full_signature: private SecurityFunction createSecurityFunctionFromEntity(SecurityFunctionEntity securityFunctionEntity)
focal_class.identifier: createSecurityFunctionFromEntity
focal_class.modifiers: private
focal_class.parameters: (SecurityFunctionEntity securityFunctionEntity)
focal_class.return: SecurityFunction
focal_class.signature: SecurityFunction createSecurityFunctionFromEntity(SecurityFunctionEntity securityFunctionEntity)
focal_method.body: @Override
      public SecurityFunction createSecurityFunction(SecurityFunctionCreateRequest request)
      {
          // Perform the validation.
          validateSecurityFunctionCreateRequest(request);
  
          // Ensure a security function with the specified security function name doesn't already exist.
          SecurityFunctionEntity securityFunctionEntity = securityFunctionDao.getSecurityFunctionByName(request.getSecurityFunctionName());
          if (securityFunctionEntity != null)
          {
              throw new AlreadyExistsException(
                  String.format("Unable to create security function \"%s\" because it already exists.", request.getSecurityFunctionName()));
          }
  
          // Create a security function entity from the request information.
          securityFunctionEntity = createSecurityFunctionEntity(request);
  
          // Persist the new entity.
          securityFunctionEntity = securityFunctionDao.saveAndRefresh(securityFunctionEntity);
  
          // Create and return the security function object from the persisted entity.
          return createSecurityFunctionFromEntity(securityFunctionEntity);
      }
focal_method.class_method_signature: SecurityFunctionServiceImpl.createSecurityFunction(SecurityFunctionCreateRequest request)
focal_method.full_signature: @Override public SecurityFunction createSecurityFunction(SecurityFunctionCreateRequest request)
focal_method.identifier: createSecurityFunction
focal_method.invocations: validateSecurityFunctionCreateRequest getSecurityFunctionByName getSecurityFunctionName format getSecurityFunctionName createSecurityFunctionEntity saveAndRefresh createSecurityFunctionFromEntity
focal_method.modifiers: @Override public
focal_method.parameters: (SecurityFunctionCreateRequest request)
focal_method.return: SecurityFunction
focal_method.signature: SecurityFunction createSecurityFunction(SecurityFunctionCreateRequest request)