GeoWebCacheDispatcher gwcd = mock(GeoWebCacheDispatcher.class);
when(gwcd.getServletPrefix()).thenReturn(null);
service = new WMTSService(sb, tld,null , mock(RuntimeStats.class));
Map<String, String> kvp = new CaseInsensitiveMap();
kvp.put("service", "WMTS");
kvp.put("version", "1.0.0");
kvp.put("request", "GetTile");
kvp.put("layer", "mockLayer");
kvp.put("format", "image/png");
kvp.put("TileMatrixSet", "GlobalCRS84Pixel");
kvp.put("TileMatrix", "GlobalCRS84Pixel:1");
kvp.put("TileRow", "0");
kvp.put("TileCol", "0");
kvp.put("Style", "Bar"); // Note singular as required by WMTS
HttpServletRequest req = mock(HttpServletRequest.class);
MockHttpServletResponse resp = new MockHttpServletResponse();
//when(req.getCharacterEncoding()).thenReturn("UTF-8");
when(req.getParameterMap()).thenReturn(kvp);