VaadinServletConfig implements VaadinConfig { @Override public VaadinContext getVaadinContext() { ensureServletConfig(); return new VaadinServletContext(config.getServletContext()); } VaadinServletConfig(ServletConfig config); @Override VaadinContext getVaadinContext(); @Override Enumeration<String> getConfigParameterNames(); @Override String getConfigParameter(String name);  }
@Test public void vaadinContextThroughConfig_setAndGetAttribute() { String value = "my-attribute"; config.getVaadinContext().setAttribute(value); String result = config.getVaadinContext().getAttribute(String.class); Assert.assertEquals(value, result); String newValue = "this is a new value"; config.getVaadinContext().setAttribute(newValue); result = config.getVaadinContext().getAttribute(String.class); Assert.assertEquals(newValue, result); result = config.getVaadinContext().getAttribute(String.class, () -> { throw new AssertionError("Should not be called"); }); Assert.assertEquals(newValue, result); }