MyAction extends ActionSupport { public String save() { System.out.println(id); System.out.println(name); return SUCCESS; }  String getId(); void setId(String id); String getName(); void setName(String name); String view(); String save(); static final Logger LOG; }
@Test public void testSave() throws Exception { request.setContent("{\"id\":\"1\",\"name\":\"nitin\"}".getBytes()); request.addHeader("Content-Type", "application/json"); request.setMethod("POST"); ActionProxy proxy = getActionProxy("/save"); actions.MyAction myAct = (actions.MyAction) proxy.getAction(); String result = proxy.execute(); System.out.println("test id : " + myAct.getId()); System.out.println("test name : " + myAct.getName()); assertEquals("success", result); System.out.println(response.getContentAsString()); }