### Question:
ChartOptions extends HashMap<String, Object> implements IClusterable, JavaScriptable, Jsonable { @Override public String toJavaScript() { return toJavaScript(name); } ChartOptions();  ChartOptions(String name);  ChartOptions(ChartOptions m);  ChartOptions(String name, Map<? extends String, ? extends Object> m); static ChartOptions fromJson(String json); static ChartOptions fromJson(JSONObject json); String getName(); void setName(String name); @Override boolean equals(Object obj); @Override int hashCode(); ChartOptions getModelObjects(); @Override String toJavaScript(); String toJavaScript(String varname); @Override JSONObject toJSON();  }### Answer:
@Test public void testToJavaScript() { String varPrefix = "var options = "; ChartOptions opts = new ChartOptions("options"); opts.put("title", "How Much Pizza I Ate Last Night"); opts.put("width", 400); opts.put("height", 300); String expResult = "var options = {\"width\":400,\"title\":\"How Much Pizza I Ate Last Night\",\"height\":300};\n"; String result = opts.toJavaScript(); assertTrue(result.startsWith(varPrefix)); assertJsonEquals(expResult.replace(varPrefix, "").replace(';', '\n'), result.replaceAll(varPrefix, "").replace(';', '\n')); }