### Question:
MyEnrichAndReformatFn extends DoFn<String, String> { public String _makeJson(String input, long timestamp) { String[] trio = input.split(","); StringBuilder sb = new StringBuilder("{"); sb.append(" \"input-point\": \"" + this.count + "\","); sb.append(" \"latitude\": \"" + trio[0] + "\","); sb.append(" \"longitude\": \"" + trio[1] + "\","); sb.append(" \"timestamp\": \"" + timestamp + "\","); sb.append(" \"timeprint\": \"" + simpleDateFormat.format(new Date(timestamp)) + "\""); sb.append(" }"); return sb.toString(); } MyEnrichAndReformatFn();  MyEnrichAndReformatFn(long arg0); @ProcessElement void processElement(@Element String element, OutputReceiver<String> receiver); long _getOffset(String input); long _calculateTimestamp(long offset); String _makeJson(String input, long timestamp);  }### Answer:
@Test public void json_parse() throws JSONException { long offset = 789; long timestampToUse = 987; String input = "123,456," + offset; String output = myEnrichAndReformatFn._makeJson(input, timestampToUse); log.info("{} -> {}", input, output); assertThat("output", output, not(nullValue())); JSONObject jsonObject = new JSONObject(output); String latitudeExtracted = jsonObject.getString("latitude"); assertThat("latitude", latitudeExtracted, not(nullValue())); assertThat("latitude", latitudeExtracted, is(equalTo("123"))); String longitudeExtracted = jsonObject.getString("longitude"); assertThat("longitude", longitudeExtracted, not(nullValue())); assertThat("longitude", longitudeExtracted, is(equalTo("456"))); String timestampExtracted = jsonObject.getString("timestamp"); assertThat("timestamp", timestampExtracted, not(nullValue())); assertThat("timestamp", timestampExtracted, is(equalTo(""+timestampToUse))); assertThat("timestampToUse", timestampToUse, not(equalTo(offset))); }