@Test
public void validateSessionKeyTest() {

    HttpSession session = null;
    Map<String, Object[]> params = null;
    String sessionKeyString = null;
    Cookie[] cookies = null;
    final String sessionKeyValue = "randomUniqueSessionID";
    // session and sessionKeyString null test
    assertFalse(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
    sessionKeyString =  "sessionkey";
    assertFalse(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
    // param and cookie null test
    session = new MockHttpSession();
    session.setAttribute(sessionKeyString, sessionKeyValue);
    assertFalse(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
    // param null, cookies not null test
    params = null;
    cookies = new Cookie[]{new Cookie(sessionKeyString, sessionKeyValue)};
    assertFalse(HttpUtils.validateSessionKey(session, params, cookies, "randomString"));
    assertTrue(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
    // param not null, cookies null test
    params = new HashMap<String, Object[]>();
    params.put(sessionKeyString, new String[]{"randomString"});
    cookies = null;
    assertFalse(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
    params.put(sessionKeyString, new String[]{sessionKeyValue});
    assertTrue(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
    // both param and cookies not null test
    params = new HashMap<String, Object[]>();
    cookies = new Cookie[]{new Cookie(sessionKeyString, sessionKeyValue)};
    params.put(sessionKeyString, new String[]{"incorrectValue"});
    assertFalse(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
    params.put(sessionKeyString, new String[]{sessionKeyValue});
    assertTrue(HttpUtils.validateSessionKey(session, params, cookies, sessionKeyString));
}