package org.lxp.dailylog.web.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class SessionHelperTest {

    @Test
    public void getRequestId() throws Exception {
        HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
        HttpSession session = Mockito.mock(HttpSession.class);
        Mockito.doReturn(null).when(request).getParameter(SessionHelper.SESSION_ID);
        Mockito.doReturn(session).when(request).getSession();
        Mockito.doReturn("sessionId").when(session).getId();

        Assert.assertEquals("sessionId", SessionHelper.getRequestId(request));
    }
}

@@ -365,28 +365,65 @@
 ic void 
-getRequestId
+shouldRetrunSessionIdWhenSessionIdParameterIsNull
 () throw
@@ -723,16 +723,62 @@
 sion();%0A
+        final String sessionId = %22sessionId%22;%0A
         
@@ -794,17 +794,16 @@
 oReturn(
-%22
 sessionI
@@ -803,17 +803,16 @@
 essionId
-%22
 ).when(s
@@ -828,17 +828,16 @@
 etId();%0A
-%0A
         
@@ -856,17 +856,16 @@
 tEquals(
-%22
 sessionI
@@ -865,17 +865,411 @@
 essionId
-%22
+, SessionHelper.getRequestId(request));%0A    %7D%0A%0A    @Test%0A    public void shouldRetrunSessionIdWhenSessionIdParameterNotNull() throws Exception %7B%0A        HttpServletRequest request = Mockito.mock(HttpServletRequest.class);%0A        final String requestId = %22requestId%22;%0A        Mockito.doReturn(requestId).when(request).getParameter(SessionHelper.SESSION_ID);%0A        Assert.assertEquals(requestId
 , Sessio

complete unit tests for getRequestId