NgTemplate extends AbstractJavaScriptComponent { public void setUserState(String key, String value) { this.userState.put(key, value); pushUserStateChange(); } NgTemplate(String templateSource, String moduleName);  NgTemplate(Package templatePackage, String moduleName);  NgTemplate(File templateFolder, String moduleName); @Override NgTemplateState getState(); void addService(final String name, final Object callback); void setUserState(String key, String value); void setUserState(String key, Object value);  }
@Test public void testSetUserState() { NgTemplate template = new NgTemplate("--", "NgTemplateTest") { private static final long serialVersionUID = 1L; }; template.setUserState("test", "bla"); assertNotNull(template.getState().userState); assertEquals("{\"test\":\"bla\"}", template.getState().userState.replaceAll("[ \n\r\t]", "")); }