LemonGraph { public static JSONObject getGraph(String jobId) throws InvalidGraphException { JSONObject ret; String uri = restUrl + "graph/" + jobId; String body = getContent(uri); ret = new JSONObject(body); return ret; } LemonGraph(); static void openConnection(); static boolean isConnected(); static void close(); static boolean isApiUp(); static JSONObject queryBasedOnPatterns(String jobId, HashMap<String, String> adapterPatterns, int startId); static JSONObject queryBasedOnPatterns(String jobId, HashMap<String, String> adapterPatterns, int startId, int stopId); static JSONObject queryBasedOnPatterns(String jobId, HashMap<String, String> adapterPatterns); static HashMap parseLemonGraphResult(JSONObject resultdata); static JSONObject resetGraph(String graphId); static JSONObject deleteGraph(String graphId); static String createGraph(JSONObject meta); static String createGraph(String graphId, JSONObject meta); static LemonGraphResponse postToGraph(String graphId, LemonGraphObject graph); static LemonGraphResponse postToGraph(LGPayload payload); static String getContent(String uri); static JSONObject getGraph(String jobId); static JSONObject getGraphCytoscape(String jobId); static JSONObject getGraphD3(String jobId); static JSONObject getGraphD3(String jobId, int start, int stop); static LemonGraphObject buildLemonGraphFromPayloadNodesandEdges(List<JSONObject> inNodes, List<JSONArray> inEdges); static void main(String[] args); final static int NOT_FOUND; static String restUrl; static HttpClient client; }
@Test public void testCallingGraphThatDoesnotExist() { String graphId = "doesnotexist"; try { JSONObject resultsb = lg.getGraph(graphId); } catch (InvalidGraphException e) { assertTrue(true); return; } fail("Never caught exception for invalid graph: " + graphId); }