DeploymentConfigurationFactory implements Serializable { protected static Properties createInitParameters( Class<?> systemPropertyBaseClass, VaadinConfig vaadinConfig) throws VaadinConfigurationException { Properties initParameters = new Properties(); readUiFromEnclosingClass(systemPropertyBaseClass, initParameters); readConfigurationAnnotation(systemPropertyBaseClass, initParameters); final VaadinContext context = vaadinConfig.getVaadinContext(); for (final Enumeration<String> e = context.getContextParameterNames(); e .hasMoreElements();) { final String name = e.nextElement(); initParameters.setProperty(name, context.getContextParameter(name)); } for (final Enumeration<String> e = vaadinConfig .getConfigParameterNames(); e.hasMoreElements();) { final String name = e.nextElement(); initParameters.setProperty(name, vaadinConfig.getConfigParameter(name)); } readBuildInfo(initParameters); return initParameters; } private  DeploymentConfigurationFactory(); static DeploymentConfiguration createDeploymentConfiguration(
            Class<?> systemPropertyBaseClass, VaadinConfig vaadinConfig); static DeploymentConfiguration createPropertyDeploymentConfiguration(
            Class<?> systemPropertyBaseClass, VaadinConfig vaadinConfig); static final Object FALLBACK_CHUNK; static final String ERROR_DEV_MODE_NO_FILES; static final String DEV_FOLDER_MISSING_MESSAGE; }
@Test public void createInitParameters_fallbackChunkObjectIsInInitParams() throws VaadinConfigurationException, IOException { ServletContext context = Mockito.mock(ServletContext.class); ServletConfig config = Mockito.mock(ServletConfig.class); Mockito.when(config.getServletContext()).thenReturn(context); Hashtable<String, String> table = new Hashtable<>( Collections.singletonMap(FrontendUtils.PARAM_TOKEN_FILE, "")); Mockito.when(context.getInitParameterNames()).thenReturn(table.keys()); Mockito.when(config.getInitParameterNames()) .thenReturn(new Hashtable<String, String>().keys()); File tokenFile = temporaryFolder.newFile(); Files.write(tokenFile.toPath(), Collections.singletonList("{ 'chunks': { " + "'fallback': {" + " 'jsModules': ['foo', 'bar']," + " 'cssImports': [ { 'value' :'foo-value' , 'id': 'bar-id'}]" + "}}" + "}")); Mockito.when(context.getInitParameter(FrontendUtils.PARAM_TOKEN_FILE)) .thenReturn(tokenFile.getPath()); Properties properties = DeploymentConfigurationFactory .createInitParameters(Object.class, new VaadinServletConfig(config)); Object object = properties .get(DeploymentConfigurationFactory.FALLBACK_CHUNK); Assert.assertTrue(object instanceof FallbackChunk); FallbackChunk chunk = (FallbackChunk) object; Set<String> modules = chunk.getModules(); Assert.assertEquals(2, modules.size()); Assert.assertTrue(modules.contains("foo")); Assert.assertTrue(modules.contains("bar")); Set<CssImportData> cssImports = chunk.getCssImports(); Assert.assertEquals(1, cssImports.size()); CssImportData data = cssImports.iterator().next(); Assert.assertEquals("foo-value", data.getValue()); Assert.assertEquals("bar-id", data.getId()); }