@Test
public void testPutPolicyLoopbackXFFMultipleValues() {

    HttpServletRequest servletRequest = Mockito.mock(HttpServletRequest.class);
    Mockito.when(servletRequest.getRemoteAddr()).thenReturn("127.0.0.1");
    Mockito.when(servletRequest.getHeader("X-Forwarded-For")).thenReturn("10.10.10.11, 10.11.11.11, 10.12.12.12");
    Mockito.when(servletRequest.isSecure()).thenReturn(true);
    TestAuditLogger alogger = new TestAuditLogger();
    ZMSImpl zmsObj = getZmsImpl(alogger);
    String userId = "user";
    Principal principal = SimplePrincipal.create("user", userId, "v=U1;d=user;n=user;s=signature", 0, null);
    ResourceContext context = createResourceContext(principal, servletRequest);
    String domainName = "DomainName";
    String policyName = "PolicyName";
    
    // Tests the putPolicy() condition : if (!policyResourceName(domainName, policyName).equals(policy.getName()))...
    try {
        Policy policy = createPolicyObject(domainName, policyName);
        
        zmsObj.putPolicy(context, domainName, "Bad" + policyName, auditRef, policy);
        fail("requesterror not thrown.");
    } catch (ResourceException e) {
        assertEquals(e.getCode(), 400);
    }
}