use of com.tvd12.ezyhttp.server.core.handler.RequestURIDecorator in project ezyhttp by youngmonkeys.
the class RequestHandlersImplementerTest method implementOneWithURIDecorator.
@Test
public void implementOneWithURIDecorator() {
// given
RequestHandlersImplementer sut = new RequestHandlersImplementer();
Controller controller = new Controller();
RequestHandlerManager manager = new RequestHandlerManager();
manager.setAllowOverrideURI(true);
RequestURIDecorator requestURIDecorator = mock(RequestURIDecorator.class);
when(requestURIDecorator.decorate(any(), any())).thenReturn("hello-world");
sut.setRequestURIDecorator(requestURIDecorator);
// when
manager.addHandlers(sut.implement(Collections.singletonList(controller)));
// then
RequestURI uri = new RequestURI(HttpMethod.GET, "/hello-world", false);
Asserts.assertThat(manager.getHandlerListByURI().get(uri).size()).isEqualsTo(2);
}
Aggregations