JSRegistry { protected static String prepareEntryValue(CodeType key, String value) { if (isAFunction(value)) { return value; } else { return prepareStringValue(key, value); } }  static String convertToJSRegistry(PluginSimpleContent plugin); static boolean JSFunctionNeedsToReturnValue(CodeType codeType);  }
@Test public void prepareTextualEntry() { assertEquals("function (){return \"\";}", JSRegistry.prepareEntryValue(CodeType.TITLE, null)); assertEquals("function (){return \"\";}", JSRegistry.prepareEntryValue(CodeType.TITLE, "")); assertEquals("function (){return \" \";}", JSRegistry.prepareEntryValue(CodeType.TITLE, " ")); assertEquals("function (){return \"Title\";}", JSRegistry.prepareEntryValue(CodeType.TITLE, "Title")); assertEquals("function (){return \"Title\";}", JSRegistry.prepareEntryValue(CodeType.TITLE, "\"Title\"")); assertEquals("function (){return \"Long Title\";}", JSRegistry.prepareEntryValue(CodeType.TITLE, "\"Long Title\"")); }
@Test public void prepareJSEntry() { assertEquals("function () { return \"ko\";}", JSRegistry.prepareEntryValue(CodeType.TITLE, "function () { return \"ko\";}")); assertEquals("function (){alert('hi');;}", JSRegistry.prepareEntryValue(CodeType.ON_CLOSE, "alert('hi');")); }