### Question:
AppcRunTasks { protected String buildPayloadFromUserParams(Map<String, Object> userParams) { if (userParams == null || userParams.size() == 0) { return null; } String payload = "{}"; for (Map.Entry<String, Object> entry : userParams.entrySet()) { payload = JsonUtils.addJsonValue(payload, entry.getKey(), (String) entry.getValue()); } payload = payload.replaceAll("\"", "\\\\\""); payload = payload.replaceAll("\n", ""); return payload; }  void preProcessActivity(BuildingBlockExecution execution); void runAppcCommand(BuildingBlockExecution execution, Action action); static final String ROLLBACK_VNF_STOP; static final String ROLLBACK_VNF_LOCK; static final String ROLLBACK_QUIESCE_TRAFFIC; static final String CONTROLLER_TYPE_DEFAULT; static final String GENERIC_APPC_ERROR_CODE; }### Answer:
@Test public void testUserParams() throws Exception { Map<String, Object> userParams = new HashMap<String, Object>(); userParams.put("existing_software_version", "3.1"); userParams.put("new_software_version", "3.2"); userParams.put("operations_timeout", "150000"); String actualPayload = appcRunTasks.buildPayloadFromUserParams(userParams); System.out.println(actualPayload); String expectedPayload = "{\\\"operations_timeout\\\":\\\"150000\\\",\\\"existing_software_version\\\":\\\"3.1\\\",\\\"new_software_version\\\":\\\"3.2\\\"}"; assertEquals(expectedPayload, actualPayload.replaceAll(" ", "")); }