@Test
public void testValidateAndTrimSecurityRoleFunctionKey()
{

    // Create a security role to function mapping key.
    SecurityRoleFunctionKey securityRoleFunctionKey = new SecurityRoleFunctionKey(SECURITY_ROLE, SECURITY_FUNCTION);
    // Mock the external calls.
    when(alternateKeyHelper.validateStringParameter("security role name", SECURITY_ROLE)).thenReturn(SECURITY_ROLE_2);
    when(alternateKeyHelper.validateStringParameter("security function name", SECURITY_FUNCTION)).thenReturn(SECURITY_FUNCTION_2);
    // Call the method under test.
    securityRoleFunctionHelper.validateAndTrimSecurityRoleFunctionKey(securityRoleFunctionKey);
    // Validate the results.
    assertEquals(new SecurityRoleFunctionKey(SECURITY_ROLE_2, SECURITY_FUNCTION_2), securityRoleFunctionKey);
    // Verify the external calls.
    verify(alternateKeyHelper).validateStringParameter("security role name", SECURITY_ROLE);
    verify(alternateKeyHelper).validateStringParameter("security function name", SECURITY_FUNCTION);
    verifyNoMoreInteractions(alternateKeyHelper);
}