Search in sources :

Example 1 with EncodedResource

use of org.springframework.web.servlet.resource.EncodedResourceResolver.EncodedResource in project spring-framework by spring-projects.

the class CssLinkResourceTransformerTests method transformSkippedForGzippedResource.

@Test
public void transformSkippedForGzippedResource(GzippedFiles gzippedFiles) throws Exception {
    gzippedFiles.create("main.css");
    this.request = new MockHttpServletRequest("GET", "/static/main.css");
    Resource original = new ClassPathResource("test/main.css", getClass());
    EncodedResource gzipped = new EncodedResource(original, "gzip", ".gz");
    Resource actual = this.transformerChain.transform(this.request, gzipped);
    assertThat(actual).isSameAs(gzipped);
}
Also used : MockHttpServletRequest(org.springframework.web.testfixture.servlet.MockHttpServletRequest) ClassPathResource(org.springframework.core.io.ClassPathResource) EncodedResource(org.springframework.web.servlet.resource.EncodedResourceResolver.EncodedResource) Resource(org.springframework.core.io.Resource) ClassPathResource(org.springframework.core.io.ClassPathResource) EncodedResource(org.springframework.web.servlet.resource.EncodedResourceResolver.EncodedResource) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 Resource (org.springframework.core.io.Resource)1 EncodedResource (org.springframework.web.servlet.resource.EncodedResourceResolver.EncodedResource)1 MockHttpServletRequest (org.springframework.web.testfixture.servlet.MockHttpServletRequest)1