@Test public void testFunction() { JsonObject args = new JsonObject(); JsonObject response = FunctionApp.main(args); assertNotNull(response); String greetings = response.getAsJsonPrimitive("greetings").getAsString(); assertNotNull(greetings); }
public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive nameArg = args.getAsJsonPrimitive("name"); String result; if (nameArg == null) { result = "Hello! Welcome to OpenWhisk"; } else { result = "Hello " + nameArg.getAsString(); } response.addProperty("greetings", result); logger.info("invoked with params:"); return response; }
FunctionApp { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive nameArg = args.getAsJsonPrimitive("name"); String result; if (nameArg == null) { result = "Hello! Welcome to OpenWhisk"; } else { result = "Hello " + nameArg.getAsString(); } response.addProperty("greetings", result); logger.info("invoked with params:"); return response; } }
FunctionApp { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive nameArg = args.getAsJsonPrimitive("name"); String result; if (nameArg == null) { result = "Hello! Welcome to OpenWhisk"; } else { result = "Hello " + nameArg.getAsString(); } response.addProperty("greetings", result); logger.info("invoked with params:"); return response; }  }
FunctionApp { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive nameArg = args.getAsJsonPrimitive("name"); String result; if (nameArg == null) { result = "Hello! Welcome to OpenWhisk"; } else { result = "Hello " + nameArg.getAsString(); } response.addProperty("greetings", result); logger.info("invoked with params:"); return response; }  static JsonObject main(JsonObject args); }
FunctionApp { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive nameArg = args.getAsJsonPrimitive("name"); String result; if (nameArg == null) { result = "Hello! Welcome to OpenWhisk"; } else { result = "Hello " + nameArg.getAsString(); } response.addProperty("greetings", result); logger.info("invoked with params:"); return response; }  static JsonObject main(JsonObject args);  }