### Question:
AddSenderIdInBodyAction extends BasicAction { @Override public HttpRequest execute(HttpRequest req, String internalURI, HttpResponse tokenValidationResponse) throws MappingException { JsonParser parser = new JsonParser(); JsonObject json= parser.parse(new String(req.getContent().toString(CharsetUtil.UTF_8))).getAsJsonObject(); log.info("request body: " + json); json.addProperty("senderId", "1232"); byte[] newContent = json.toString().getBytes(CharsetUtil.UTF_8); ChannelBuffer buf = ChannelBuffers.copiedBuffer(newContent); req.setContent(buf); HttpHeaders.setContentLength(req, newContent.length); return req; }  @Override HttpRequest execute(HttpRequest req, String internalURI, HttpResponse tokenValidationResponse); static Logger log; }### Answer:
@Test public void when_execute_add_senderId_in_request_body() throws Exception { HttpResponse validationResponse = mock(HttpResponse.class); ChannelBuffer content = ChannelBuffers.copiedBuffer(("{\"valid\":true,\"codeId\":\"\",\"scope\":\"basic scope2\"," + "\"details\":null,\"token\":\"f60971beb3881ea0bd5675a5baf2a47e95332277\",\"created\":1409043454427,\"expiresIn\":\"300\"," + "\"userId\":\"12345\",\"refreshToken\":\"ae79692416349da03fcdff1beca6e131ab3e5de1\",\"type\":\"Bearer\",\"clientId\":\"196657904238186\"}").getBytes(CharsetUtil.UTF_8)); willReturn(content).given(validationResponse).getContent(); HttpRequest request = action.execute(req, "/payments", validationResponse); JsonParser parser = new JsonParser(); JsonObject json = parser.parse(new String(request.getContent().toString(CharsetUtil.UTF_8))).getAsJsonObject(); assertEquals(json.get("senderId").getAsString(), "1232"); }