Search in sources :

Example 1 with HttpHeader

use of org.glassfish.grizzly.http.HttpHeader in project Payara by payara.

the class HSTSFilterTest method headerTestAllTrue.

@Test
public void headerTestAllTrue() throws IOException {
    Ssl mockedSsl = Mockito.mock(Ssl.class);
    Mockito.when(mockedSsl.getHstsEnabled()).thenReturn("true");
    Mockito.when(mockedSsl.getHstsPreload()).thenReturn("true");
    Mockito.when(mockedSsl.getHstsSubdomains()).thenReturn("true");
    HttpHeader header = processFilter(mockedSsl);
    Assert.assertEquals(EXPECTED_ALL, header.getHeader(HSTS_HEADER));
}
Also used : HttpHeader(org.glassfish.grizzly.http.HttpHeader) Ssl(org.glassfish.grizzly.config.dom.Ssl) Test(org.junit.Test)

Example 2 with HttpHeader

use of org.glassfish.grizzly.http.HttpHeader in project Payara by payara.

the class HSTSFilterTest method headerTestJustMax.

@Test
public void headerTestJustMax() throws IOException {
    Ssl mockedSsl = Mockito.mock(Ssl.class);
    Mockito.when(mockedSsl.getHstsEnabled()).thenReturn("true");
    Mockito.when(mockedSsl.getHstsPreload()).thenReturn("false");
    Mockito.when(mockedSsl.getHstsSubdomains()).thenReturn("false");
    HttpHeader header = processFilter(mockedSsl);
    Assert.assertEquals(EXPECTED_MAX, header.getHeader(HSTS_HEADER));
}
Also used : HttpHeader(org.glassfish.grizzly.http.HttpHeader) Ssl(org.glassfish.grizzly.config.dom.Ssl) Test(org.junit.Test)

Aggregations

Ssl (org.glassfish.grizzly.config.dom.Ssl)2 HttpHeader (org.glassfish.grizzly.http.HttpHeader)2 Test (org.junit.Test)2