public void testGetCap() throws Exception {
GeoWebCacheDispatcher gwcd = mock(GeoWebCacheDispatcher.class);
when(gwcd.getServletPrefix()).thenReturn(null);
service = new WMSService(sb, tld, mock(RuntimeStats.class), new NullURLMangler(), gwcd);
@SuppressWarnings("unchecked")
Map<String, String> kvp = new CaseInsensitiveMap();
kvp.put("service", "WMS");
kvp.put("version", "1.1.1");
kvp.put("request", "GetCapabilities");
HttpServletRequest req = mock(HttpServletRequest.class);
MockHttpServletResponse resp = new MockHttpServletResponse();
when(req.getCharacterEncoding()).thenReturn("UTF-8");
when(req.getParameterMap()).thenReturn(kvp);
List<String> gridSetNames = Arrays.asList("GlobalCRS84Pixel", "GlobalCRS84Scale","EPSG:4326");
TileLayer tileLayer = mockTileLayer("mockLayer", gridSetNames);
when(tld.getLayerList()).thenReturn(Arrays.asList(tileLayer));
ConveyorTile conv = service.getConveyor(req, resp);
assertNotNull(conv);
final String layerName = conv.getLayerId();
assertNull(layerName);
assertEquals(Conveyor.RequestHandler.SERVICE,conv.reqHandler);
WMSGetCapabilities wmsCap = new WMSGetCapabilities(tld, conv.servletReq,"http://localhost:8080", "/service/wms", new NullURLMangler());
wmsCap.writeResponse(conv.servletResp);
assertTrue(resp.containsHeader("content-disposition"));
assertEquals("inline;filename=wms-getcapabilities.xml", resp.getHeader("content-disposition"));
}