Search in sources :

Example 6 with TesterResponse

use of org.apache.tomcat.unittest.TesterResponse in project tomcat by apache.

the class TestResponseUtil method testAddValidWithPartiallyValidSingleHeaderAlreadyPresent.

@Test
public void testAddValidWithPartiallyValidSingleHeaderAlreadyPresent() {
    TesterResponse response = new TesterResponse();
    response.getCoyoteResponse();
    response.addHeader("vary", "{{{, bar");
    List<String> expected = new ArrayList<>();
    expected.add("bar");
    doTestAddVaryFieldName(response, "bar", expected);
}
Also used : ArrayList(java.util.ArrayList) TesterResponse(org.apache.tomcat.unittest.TesterResponse) Test(org.junit.Test)

Example 7 with TesterResponse

use of org.apache.tomcat.unittest.TesterResponse in project tomcat by apache.

the class TestResponseUtil method testAddValidWithPartiallyValidSingleHeaderIncludingAll.

@Test
public void testAddValidWithPartiallyValidSingleHeaderIncludingAll() {
    TesterResponse response = new TesterResponse();
    response.getCoyoteResponse();
    response.addHeader("vary", "{{{, *");
    List<String> expected = new ArrayList<>();
    expected.add("*");
    doTestAddVaryFieldName(response, "too", expected);
}
Also used : ArrayList(java.util.ArrayList) TesterResponse(org.apache.tomcat.unittest.TesterResponse) Test(org.junit.Test)

Example 8 with TesterResponse

use of org.apache.tomcat.unittest.TesterResponse in project tomcat by apache.

the class TestResponseUtil method testAddValidWithValidHeadersAlreadyPresent.

@Test
public void testAddValidWithValidHeadersAlreadyPresent() {
    TesterResponse response = new TesterResponse();
    response.getCoyoteResponse();
    response.addHeader("vary", "foo");
    response.addHeader("vary", "bar");
    List<String> expected = new ArrayList<>();
    expected.add("foo");
    expected.add("bar");
    doTestAddVaryFieldName(response, "foo", expected);
}
Also used : ArrayList(java.util.ArrayList) TesterResponse(org.apache.tomcat.unittest.TesterResponse) Test(org.junit.Test)

Example 9 with TesterResponse

use of org.apache.tomcat.unittest.TesterResponse in project tomcat by apache.

the class TestResponseUtil method testAddValidWithValidSingleHeaderIncludingAll.

@Test
public void testAddValidWithValidSingleHeaderIncludingAll() {
    TesterResponse response = new TesterResponse();
    response.getCoyoteResponse();
    response.addHeader("vary", "foo, *");
    List<String> expected = new ArrayList<>();
    expected.add("*");
    doTestAddVaryFieldName(response, "too", expected);
}
Also used : ArrayList(java.util.ArrayList) TesterResponse(org.apache.tomcat.unittest.TesterResponse) Test(org.junit.Test)

Example 10 with TesterResponse

use of org.apache.tomcat.unittest.TesterResponse in project tomcat by apache.

the class TestResponseUtil method testAddValidWithAll.

@Test
public void testAddValidWithAll() {
    TesterResponse response = new TesterResponse();
    response.getCoyoteResponse();
    response.addHeader("vary", "host");
    List<String> expected = new ArrayList<>();
    expected.add("*");
    doTestAddVaryFieldName(response, "*", expected);
}
Also used : ArrayList(java.util.ArrayList) TesterResponse(org.apache.tomcat.unittest.TesterResponse) Test(org.junit.Test)

Aggregations

TesterResponse (org.apache.tomcat.unittest.TesterResponse)18 ArrayList (java.util.ArrayList)14 Test (org.junit.Test)14 Context (org.apache.catalina.Context)6 TesterContext (org.apache.tomcat.unittest.TesterContext)6 Response (org.apache.catalina.connector.Response)4 TesterMapRealm (org.apache.catalina.startup.TesterMapRealm)4 TesterRequest (org.apache.tomcat.unittest.TesterRequest)4 Request (org.apache.catalina.connector.Request)2 SecurityConstraint (org.apache.catalina.deploy.SecurityConstraint)2 Tomcat (org.apache.catalina.startup.Tomcat)2 SecurityConstraint (org.apache.tomcat.util.descriptor.web.SecurityConstraint)2 ServletSecurityElement (jakarta.servlet.ServletSecurityElement)1 ServletSecurity (jakarta.servlet.annotation.ServletSecurity)1 ServletSecurityElement (javax.servlet.ServletSecurityElement)1 ServletSecurity (javax.servlet.annotation.ServletSecurity)1 FilterMap (org.apache.catalina.deploy.FilterMap)1 SecurityCollection (org.apache.catalina.deploy.SecurityCollection)1 FilterMap (org.apache.tomcat.util.descriptor.web.FilterMap)1 SecurityCollection (org.apache.tomcat.util.descriptor.web.SecurityCollection)1