CustomVariables { public String toString() { JSONObject json = new JSONObject(mVars); return json.length() > 0 ? json.toString() : null; } CustomVariables();  CustomVariables(@NonNull CustomVariables variables);  CustomVariables(@Nullable String json); CustomVariables putAll(CustomVariables customVariables); CustomVariables put(int index, String name, String value); CustomVariables put(String index, JSONArray values); String toString(); int size(); TrackMe injectVisitVariables(@NonNull TrackMe trackMe); @NonNull TrackMe toVisitVariables();  }
@Test public void testToString() throws Exception { CustomVariables cv = new CustomVariables(); cv.put(1, "name", "value"); cv.put(2, "name2", "uńicódę"); String cvJson = cv.toString(); new JSONObject(cvJson); assertTrue(cvJson.contains("\"2\":[\"name2\",\"uńicódę\"]")); assertTrue(cvJson.contains("\"1\":[\"name\",\"value\"]")); }