ExecuteScriptAction extends SymbolAction { public String getScript() { return script; }  @Override ExecuteResult execute(ConnectorManager connector); String getScript(); void setScript(String script); String getName(); void setName(String name); boolean isAsync(); void setAsync(boolean async); int getTimeout(); void setTimeout(int timeout);  }
@Test public void testJSON() throws IOException { ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(action); ExecuteScriptAction c2 = mapper.readValue(json, ExecuteScriptAction.class); assertEquals(action.getScript(), c2.getScript()); }
@Test public void testJSONFile() throws IOException, URISyntaxException { ObjectMapper mapper = new ObjectMapper(); File file = new File(getClass().getResource("/actions/websymbolactions/ExecuteScriptTestData.json").toURI()); SymbolAction obj = mapper.readValue(file, SymbolAction.class); assertTrue(obj instanceof ExecuteScriptAction); ExecuteScriptAction objAsAction = (ExecuteScriptAction) obj; assertEquals("document.write('hello')", objAsAction.getScript()); }