@Test
public void testDeleteSecurityRoleFunction()
{

    // Create a security role to function mapping key.
    SecurityRoleFunctionKey securityRoleFunctionKey = new SecurityRoleFunctionKey(SECURITY_ROLE, SECURITY_FUNCTION);
    // 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);
    // Create a security role to function mapping entity.
    SecurityRoleFunctionEntity securityRoleFunctionEntity = new SecurityRoleFunctionEntity();
    securityRoleFunctionEntity.setId(ID);
    securityRoleFunctionEntity.setSecurityRole(securityRoleEntity);
    securityRoleFunctionEntity.setSecurityFunction(securityFunctionEntity);
    // Mock the external calls.
    when(securityRoleFunctionDaoHelper.getSecurityRoleFunctionEntity(securityRoleFunctionKey)).thenReturn(securityRoleFunctionEntity);
    // Call the method under test.
    SecurityRoleFunction result = securityRoleFunctionService.deleteSecurityRoleFunction(securityRoleFunctionKey);
    // Validate the results.
    assertEquals(new SecurityRoleFunction(ID, securityRoleFunctionKey), result);
    // Verify the external calls.
    verify(securityRoleFunctionHelper).validateAndTrimSecurityRoleFunctionKey(securityRoleFunctionKey);
    verify(securityRoleFunctionDaoHelper).getSecurityRoleFunctionEntity(securityRoleFunctionKey);
    verify(securityRoleFunctionDao).delete(securityRoleFunctionEntity);
    verifyNoMoreInteractionsHelper();
}