quarkiverse / quarkus-renarde

Server-side Web Framework with Qute templating, magic/easier controllers, auth, reverse-routing
Apache License 2.0
73 stars 16 forks source link

use a Supplier to get UriInfo #182

Closed gbourant closed 6 months ago

gbourant commented 7 months ago

fixes #181

With this way i can use a mock for UriInfo.

UriBuilder uriBuilder = UriBuilder.fromUri("https://gbourant.com");
UriInfo mock = Mockito.mock(UriInfo.class);
when(mock.getBaseUriBuilder()).thenReturn( uriBuilder);
Router.uriInfoSupplier = () -> mock;

Maybe we can do better, if ControllerVisitor can detect that we are under a test and provide a default UriBuilder so the mock is no more needed?