import com.mockrunner.mock.web.MockServletInputStream;
public class DispatcherTest extends TestCase {
public void testReadOpContext() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath("/geoserver");
request.setRequestURI("/geoserver/hello");
request.setMethod("get");
Dispatcher dispatcher = new Dispatcher();
Map map = dispatcher.readOpContext(request);
assertEquals("hello", map.get("service"));
assertNull(map.get("request"));
request = new MockHttpServletRequest();
request.setContextPath("/geoserver");
request.setRequestURI("/geoserver/hello/Hello");
request.setMethod("get");
map = dispatcher.readOpContext(request);
request = new MockHttpServletRequest();
request.setContextPath("/geoserver");
request.setRequestURI("/geoserver/hello/Hello/");
request.setMethod("get");
map = dispatcher.readOpContext(request);
assertEquals("hello", map.get("service"));
assertEquals("Hello", map.get("request"));
}