@Test public void testAddToScriptHash() throws Exception { Map<String, Object> hash = new HashMap<String, Object>(); addToScriptHash(hash, "x", "y", null, null); assertEquals("y", hash.get("x")); addToScriptHash(hash, "y", "", null, null); assertNull(hash.get("y")); assertFalse(hash.containsKey("y")); addToScriptHash(hash, "y1", null, null, null); assertNull(hash.get("y1")); assertFalse(hash.containsKey("y1")); addToScriptHash(hash, "st", "server", "", null); assertEquals("server", hash.get("st")); addToScriptHash(hash, "st1", "ajax", "ajax", null); assertNull(hash.get("st1")); assertFalse(hash.containsKey("st1")); addToScriptHash(hash, "st2", "", "ajax", null); assertNull(hash.get("st2")); assertFalse(hash.containsKey("st2")); addToScriptHash(hash, "null", null, "server", null); assertNull(hash.get("null")); assertFalse(hash.containsKey("null")); addToScriptHash(hash, "b", false, null, null); assertNull(hash.get("b")); assertFalse(hash.containsKey("b")); addToScriptHash(hash, "b1", true, null, null); assertEquals(Boolean.TRUE, hash.get("b1")); addToScriptHash(hash, "b2", true, "true", null); assertNull(hash.get("b2")); assertFalse(hash.containsKey("b2")); addToScriptHash(hash, "b3", false, "true", null); assertEquals(Boolean.FALSE, hash.get("b3")); addToScriptHash(hash, "b4", true, "false", null); assertEquals(Boolean.TRUE, hash.get("b4")); addToScriptHash(hash, "b5", false, "false", null); assertNull(hash.get("b5")); assertFalse(hash.containsKey("b5")); addToScriptHash(hash, "i", Integer.valueOf(0), null, null); assertEquals(Integer.valueOf(0), hash.get("i")); addToScriptHash(hash, "i1", Integer.valueOf(0), "0", null); assertNull(hash.get("i1")); assertFalse(hash.containsKey("i1")); addToScriptHash(hash, "i2", Integer.valueOf(0), "1", null); assertEquals(Integer.valueOf(0), hash.get("i2")); addToScriptHash(hash, "i3", Integer.MIN_VALUE, null, null); assertNull(hash.get("i3")); assertFalse(hash.containsKey("i3")); addToScriptHash(hash, "i4", Integer.MIN_VALUE, "0", null); assertNull(hash.get("i4")); assertFalse(hash.containsKey("i4")); addToScriptHash(hash, "plain", "test", null, ScriptHashVariableWrapper.noop); assertEquals("test", hash.get("plain")); addToScriptHash(hash, "plain1", "newtest", "blank", ScriptHashVariableWrapper.noop); assertEquals("newtest", hash.get("plain1")); addToScriptHash(hash, "onclick", "alert(1)", null, ScriptHashVariableWrapper.eventHandler); assertTrue(hash.get("onclick") instanceof JSFunctionDefinition); addToScriptHash(hash, "onclick1", "alert(1)", "no-val", ScriptHashVariableWrapper.eventHandler); assertTrue(hash.get("onclick1") instanceof JSFunctionDefinition); }
public static void addToScriptHash(Map<String, Object> hash, String name, Object value) { addToScriptHash(hash, name, value, null, null); }
RenderKitUtils { public static void addToScriptHash(Map<String, Object> hash, String name, Object value) { addToScriptHash(hash, name, value, null, null); } }
RenderKitUtils { public static void addToScriptHash(Map<String, Object> hash, String name, Object value) { addToScriptHash(hash, name, value, null, null); } private  RenderKitUtils(); }
RenderKitUtils { public static void addToScriptHash(Map<String, Object> hash, String name, Object value) { addToScriptHash(hash, name, value, null, null); } private  RenderKitUtils(); static String[] asArray(Object object); static boolean shouldRenderAttribute(Object attributeValue); static String prefixAttributeName(String attributeName, boolean isXhtmlMode); static String prefixAttributeName(String attributeName, ResponseWriter responseWriter); static void renderAttribute(FacesContext facesContext, String attributeName, Object attributeValue); static Object getAttributeAndBehaviorsValue(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderAttributeAndBehaviors(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderPassThroughAttributesOptimized(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Collection<ComponentAttribute> attributes); static String decodeBehaviors(FacesContext context, UIComponent component); static Attributes attributes(); static Attributes attributes(Enum<?>... attrs); static Attributes attributes(String... attrs); static void addToScriptHash(Map<String, Object> hash, String name, Object value); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue,
            ScriptHashVariableWrapper wrapper); static void addToScriptHash(Map<String, Object> hash, FacesContext facesContext, UIComponent component,
            Attributes attributes, ScriptHashVariableWrapper wrapper); static String toScriptArgs(Object... objects); static String getResourcePath(FacesContext context, String library, String resourceName); static String getResourceURL(String url, FacesContext context); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent component); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent componentA, UIComponent componentB); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent... components); static String getBehaviorSourceId(FacesContext facesContext); static boolean hasFacet(UIComponent component, String facetName); @SuppressWarnings("unchecked") static T evaluateAttribute(String attribute, UIComponent component, FacesContext context); }
RenderKitUtils { public static void addToScriptHash(Map<String, Object> hash, String name, Object value) { addToScriptHash(hash, name, value, null, null); } private  RenderKitUtils(); static String[] asArray(Object object); static boolean shouldRenderAttribute(Object attributeValue); static String prefixAttributeName(String attributeName, boolean isXhtmlMode); static String prefixAttributeName(String attributeName, ResponseWriter responseWriter); static void renderAttribute(FacesContext facesContext, String attributeName, Object attributeValue); static Object getAttributeAndBehaviorsValue(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderAttributeAndBehaviors(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderPassThroughAttributesOptimized(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Collection<ComponentAttribute> attributes); static String decodeBehaviors(FacesContext context, UIComponent component); static Attributes attributes(); static Attributes attributes(Enum<?>... attrs); static Attributes attributes(String... attrs); static void addToScriptHash(Map<String, Object> hash, String name, Object value); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue,
            ScriptHashVariableWrapper wrapper); static void addToScriptHash(Map<String, Object> hash, FacesContext facesContext, UIComponent component,
            Attributes attributes, ScriptHashVariableWrapper wrapper); static String toScriptArgs(Object... objects); static String getResourcePath(FacesContext context, String library, String resourceName); static String getResourceURL(String url, FacesContext context); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent component); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent componentA, UIComponent componentB); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent... components); static String getBehaviorSourceId(FacesContext facesContext); static boolean hasFacet(UIComponent component, String facetName); @SuppressWarnings("unchecked") static T evaluateAttribute(String attribute, UIComponent component, FacesContext context);  }