SetVariableByCookieAction extends SetVariableAction { public CookieType getCookieType() { return cookieType; }  @Override ExecuteResult execute(ConnectorManager connector); CookieType getCookieType(); void setCookieType(CookieType type);  }
@Test public void testJSON() throws IOException { ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(setAction); SetVariableByCookieAction setAction2 = mapper.readValue(json, SetVariableByCookieAction.class); assertEquals(setAction.getName(), setAction2.getName()); assertEquals(setAction.getValue(), setAction2.getValue()); assertEquals(setAction.getCookieType(), setAction2.getCookieType()); }
@Test public void testJSONFile() throws IOException, URISyntaxException { ObjectMapper mapper = new ObjectMapper(); URI uri = getClass().getResource("/actions/StoreSymbolActions/SetVariableByCookieTestData.json").toURI(); File file = new File(uri); SymbolAction obj = mapper.readValue(file, SymbolAction.class); assertTrue(obj instanceof SetVariableByCookieAction); SetVariableByCookieAction objAsAction = (SetVariableByCookieAction) obj; assertEquals(VARIABLE_NAME, objAsAction.getName()); assertEquals(COOKIE_NAME, objAsAction.getValue()); assertEquals(SetVariableByCookieAction.CookieType.WEB, objAsAction.getCookieType()); }