public void testGetPluginContextPath() throws Exception {
MockServletContext servletContext = new MockServletContext("/myapp");
MockHttpServletRequest request = new MockHttpServletRequest(servletContext);
request.setContextPath("/myapp");
assertEquals("", GrailsResourceUtils.getStaticResourcePathForResource(new UrlResource(TEST_CONTROLLER_URL), null));
assertEquals("plugins/myplugin", GrailsResourceUtils.getStaticResourcePathForResource(
new UrlResource(TEST_PLUGIN_CTRL), null));
assertEquals("", GrailsResourceUtils.getStaticResourcePathForResource(new UrlResource(WEBINF_CONTROLLER), null));
assertEquals("plugins/myplugin", GrailsResourceUtils.getStaticResourcePathForResource(
new UrlResource(WEBINF_PLUGIN_CTRL), null));
assertEquals("/myapp", GrailsResourceUtils.getStaticResourcePathForResource(
new UrlResource(WEBINF_CONTROLLER), request.getContextPath()));
assertEquals("/myapp/plugins/myplugin", GrailsResourceUtils.getStaticResourcePathForResource(
new UrlResource(WEBINF_PLUGIN_CTRL), request.getContextPath()));
}