diff --git a/src/main/Main.java b/src/main/Main.java index 46054ed..b4b7531 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -21,6 +21,9 @@ // post.start(); init(); api.jsonAcquisition("src/main/you.json"); + System.out.println(api.getReadJson()); + api.jsonRemove(api.getReadJson().get("snippet"), "title"); + System.out.println(api.getReadJson()); //api.doRestTest(); System.out.println(api.getResults()); } diff --git a/src/main/you.json b/src/main/you.json index 6fc3acb..f6f8f1b 100644 --- a/src/main/you.json +++ b/src/main/you.json @@ -1,5 +1,6 @@ { "snippet" : { - "title" : "aaa" + "title" : "aaa", + "status" : "e" } } \ No newline at end of file diff --git a/src/restfulchecker/RestChecker.java b/src/restfulchecker/RestChecker.java index 60f76c6..905674d 100644 --- a/src/restfulchecker/RestChecker.java +++ b/src/restfulchecker/RestChecker.java @@ -27,6 +27,7 @@ private NecessaryParam getnesParam = new NecessaryParam(); private ArrayList removeParam = new ArrayList<>(); private JsonNode readJson; + private boolean isRemove = false; public static final int ACCOUNT_NUM = 5; @@ -64,6 +65,10 @@ return getnesParam; } + public JsonNode getReadJson() { + return readJson; + } + public void setupRestTest(Method method, ArrayList queryParam, ArrayList formParam, ArrayList pathParam) { this.type = method; @@ -104,7 +109,12 @@ } account.doAnything(); responses.add(account.getResponseCode()); - receives.add(account.doReceive()); + String receive = account.doReceive(); + for (String remove : removeParam) { + jsonRemove(receive, remove); + isRemove = true; + } + receives.add(receive); ReadResource(results); ReadResource(beforeResults); } @@ -149,6 +159,8 @@ } if (judgeResult.indexOf(method) != -1) { System.out.println("OK"); + if (isRemove) + System.out.println("This is Quasi " + judgeResult); } else { System.out.println("WARNING!! Perhaps:" + judgeResult); } @@ -166,16 +178,18 @@ account.addPathParam(param); } account.doAnything(); - results.add(account.doReceive()); + String receive = account.doReceive(); + for (String remove : removeParam) { + jsonRemove(receive, remove); + isRemove = true; + } + results.add(receive); } public void jsonAcquisition(String path) { ObjectMapper json = new ObjectMapper(); try { readJson = json.readTree(new File(path)); - JsonNode gg = readJson.get("snippet"); - jsonRemove(gg, "title"); - System.out.println(readJson); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace();