@Test @Ignore public void testNotFound() { JsonObject args = new JsonObject(); args.addProperty("id", "blah"); JsonObject response = FindEngagement.main(args); System.out.println(response); assertEquals(new JsonObject(), response); }
public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive idArg = args.getAsJsonPrimitive("id"); if (idArg == null) { response.addProperty("result", "id not provided"); } else { EngagementStore store = new EngagementStore(args, "engagements"); Engagement engagement = store.findById(idArg.getAsString()); if (engagement != null) { JsonElement jsonElement = new Gson().toJsonTree(engagement); response = jsonElement.getAsJsonObject(); } else { response = response; } } return response; }
FindEngagement { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive idArg = args.getAsJsonPrimitive("id"); if (idArg == null) { response.addProperty("result", "id not provided"); } else { EngagementStore store = new EngagementStore(args, "engagements"); Engagement engagement = store.findById(idArg.getAsString()); if (engagement != null) { JsonElement jsonElement = new Gson().toJsonTree(engagement); response = jsonElement.getAsJsonObject(); } else { response = response; } } return response; } }
FindEngagement { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive idArg = args.getAsJsonPrimitive("id"); if (idArg == null) { response.addProperty("result", "id not provided"); } else { EngagementStore store = new EngagementStore(args, "engagements"); Engagement engagement = store.findById(idArg.getAsString()); if (engagement != null) { JsonElement jsonElement = new Gson().toJsonTree(engagement); response = jsonElement.getAsJsonObject(); } else { response = response; } } return response; }  }
FindEngagement { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive idArg = args.getAsJsonPrimitive("id"); if (idArg == null) { response.addProperty("result", "id not provided"); } else { EngagementStore store = new EngagementStore(args, "engagements"); Engagement engagement = store.findById(idArg.getAsString()); if (engagement != null) { JsonElement jsonElement = new Gson().toJsonTree(engagement); response = jsonElement.getAsJsonObject(); } else { response = response; } } return response; }  static JsonObject main(JsonObject args); }
FindEngagement { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); JsonPrimitive idArg = args.getAsJsonPrimitive("id"); if (idArg == null) { response.addProperty("result", "id not provided"); } else { EngagementStore store = new EngagementStore(args, "engagements"); Engagement engagement = store.findById(idArg.getAsString()); if (engagement != null) { JsonElement jsonElement = new Gson().toJsonTree(engagement); response = jsonElement.getAsJsonObject(); } else { response = response; } } return response; }  static JsonObject main(JsonObject args);  }