Code example for UriPatternMatcher

0
 
    @Test 
    public void testRegisterUnregister() throws Exception { 
        final HttpAsyncRequestHandler<?> h = Mockito.mock(HttpAsyncRequestHandler.class);
 
        final UriPatternMatcher<HttpAsyncRequestHandler<?>> matcher = Mockito.spy(
                new UriPatternMatcher<HttpAsyncRequestHandler<?>>());
        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper(matcher);
 
        registry.register("/h1", h);
        registry.unregister("/h1");
 
        Mockito.verify(matcher).register("/h1", h);
        Mockito.verify(matcher).unregister("/h1"); 
    } 
 
    @Test 
    public void testLookup() throws Exception { 
        final UriPatternMatcher<HttpAsyncRequestHandler<?>> matcher = Mockito.spy(
                new UriPatternMatcher<HttpAsyncRequestHandler<?>>());
        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper(matcher);