### Question:
FunctionApp { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); String text = null; if (args.has("text")) { text = args.getAsJsonPrimitive("text").getAsString(); } String[] results = new String[] { text }; if (text != null && text.indexOf(",") != -1) { results = text.split(","); } JsonArray splitStrings = new JsonArray(); for (String var : results) { splitStrings.add(var); } response.add("result", splitStrings); return response; }  static JsonObject main(JsonObject args);  }### Answer:
@Test public void testFunction() { JsonObject args = new JsonObject(); args.addProperty("text", "apple,orange,banana"); JsonObject response = FunctionApp.main(args); assertNotNull(response); JsonArray results = response.getAsJsonArray("result"); assertNotNull(results); assertEquals(3, results.size()); List<String> actuals = new ArrayList<>(); results.forEach(j -> actuals.add(j.getAsString())); assertTrue(actuals.contains("apple")); assertTrue(actuals.contains("orange")); assertTrue(actuals.contains("banana")); }