VaadinServletContext implements VaadinContext { @Override public <T> void setAttribute(Class<T> clazz, T value) { if (value == null) { removeAttribute(clazz); } else { ensureServletContext(); context.setAttribute(clazz.getName(), value); } } VaadinServletContext(ServletContext context); ServletContext getContext(); @Override T getAttribute(Class<T> type, Supplier<T> defaultValueSupplier); @Override void setAttribute(Class<T> clazz, T value); @Override void removeAttribute(Class<?> clazz); @Override Enumeration<String> getContextParameterNames(); @Override String getContextParameter(String name);  }
@Test(expected = AssertionError.class) public void setNullAttributeNotAllowed() { context.setAttribute(null); }