modules/spring-mock-mvc/src/main/java/io/restassured/module/mockmvc/specification/MockMvcRequestSpecBuilder.java
public MockMvcRequestSpecBuilder setSessionId(String sessionIdName, String sessionIdValue) {
        spec.sessionId(sessionIdName, sessionIdValue);
        return this;
    }
public MockMvcRequestSpecBuilder setSessionId(String sessionIdName, String sessionIdValue) {
        spec.sessionId(sessionIdName, sessionIdValue);
        return this;
    }
public MockMvcRequestSpecBuilder setSessionId ( String sessionIdName , String sessionIdValue ) { spec . sessionId ( sessionIdName , sessionIdValue ) ; return this ; }
Set the session id name and value for this request. It'll override the default session id name from the configuration (by default this is {@value SessionConfig#DEFAULT_SESSION_ID_NAME}).
You can configure the default session id name by using:
<pre>
RestAssuredMockMvc.config = newConfig().sessionConfig(new SessionConfig().sessionIdName(&lt;sessionIdName&gt;));
</pre>
and then you can use the {@link MockMvcRequestSpecBuilder#setSessionId(String)} method to set the session id value without specifying the name for each request.

@param sessionIdName  The session id name
@param sessionIdValue The session id value.
@return The request specification
Set the session id name and value for this request . It ll override the default session id name from the configuration ( by default this is { @value SessionConfig#DEFAULT_SESSION_ID_NAME } ) . You can configure the default session id name by using : <pre > RestAssuredMockMvc . config = newConfig () . sessionConfig ( new SessionConfig () . sessionIdName ( &lt ; sessionIdName&gt ; )) ; < / pre > and then you can use the { @link MockMvcRequestSpecBuilder#setSessionId ( String ) } method to set the session id value without specifying the name for each request .