use of com.vaadin.flow.server.StaticFileHandler in project flow by vaadin.
the class LookupInitializerTest method initialize_noStaticFileHandlerFactory_defaultStaticFileHandlerFactoryCreated.
@Test
public void initialize_noStaticFileHandlerFactory_defaultStaticFileHandlerFactoryCreated() throws ServletException {
AtomicReference<Lookup> capture = new AtomicReference<>();
initializer.initialize(null, new HashMap<>(), capture::set);
Lookup lookup = capture.get();
StaticFileHandlerFactory factory = lookup.lookup(StaticFileHandlerFactory.class);
VaadinService service = Mockito.mock(VaadinService.class);
DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(service.getDeploymentConfiguration()).thenReturn(configuration);
ClassLoader loader = Mockito.mock(ClassLoader.class);
Mockito.when(service.getClassLoader()).thenReturn(loader);
StaticFileHandler handler = factory.createHandler(service);
Assert.assertNotNull(handler);
Assert.assertEquals(StaticFileServer.class, handler.getClass());
}
Aggregations