@Test @Ignore public void testFound() { JsonObject args = new JsonObject(); EngagementStore store = new EngagementStore(args, "engagements"); Engagement tempObj = new Engagement( "TestObj", "Valhalla",new Date()); tempObj = store.persist(tempObj); Engagement engagement = store.findById(tempObj.get_id()); assertEquals("TestObj", engagement.getName()); args.addProperty("id", engagement.get_id()); JsonObject response = DeleteEngagement.main(args); System.out.println(response); assertEquals("OK", response.getAsJsonPrimitive("result").getAsString()); }
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) { store.delete(engagement); response.addProperty("result", "OK"); } else { response.addProperty("result", "object not found"); } } return response; }
DeleteEngagement { 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) { store.delete(engagement); response.addProperty("result", "OK"); } else { response.addProperty("result", "object not found"); } } return response; } }
DeleteEngagement { 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) { store.delete(engagement); response.addProperty("result", "OK"); } else { response.addProperty("result", "object not found"); } } return response; }  }
DeleteEngagement { 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) { store.delete(engagement); response.addProperty("result", "OK"); } else { response.addProperty("result", "object not found"); } } return response; }  static JsonObject main(JsonObject args); }
DeleteEngagement { 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) { store.delete(engagement); response.addProperty("result", "OK"); } else { response.addProperty("result", "object not found"); } } return response; }  static JsonObject main(JsonObject args);  }