diff --git a/src/restfulchecker/RestApi.java b/src/restfulchecker/RestApi.java index 079d531..b2c69f3 100644 --- a/src/restfulchecker/RestApi.java +++ b/src/restfulchecker/RestApi.java @@ -6,12 +6,14 @@ public class RestApi { private ArrayList accounts = new ArrayList<>(); private ArrayList results = new ArrayList<>(); + private ArrayList beforeResults = new ArrayList<>(); private ArrayList responses = new ArrayList<>(); private Method type; private ArrayList queryParam; private ArrayList formParam; private ArrayList pathParam; private String judgeResult; + public static final int ACCOUNT_NUM = 5; public void setAccount(String url) { @@ -27,6 +29,10 @@ return results; } + public ArrayList getBeforeResults() { + return beforeResults; + } + public String getJudgeResult() { return judgeResult; } @@ -87,19 +93,21 @@ private boolean listAllEquals() { String first = results.get(0); int firstres = responses.get(0); - Iterator res = responses.iterator(); for (String s : results) { - if(firstres != 200) + if (firstres != 200 || !s.equals(first)) return false; - if (!s.equals(first)) - return false; - firstres = (int)res.next(); } return true; } - + private void judgeMethod() { - + ArrayList identically = new ArrayList<>(); + Iterator current = beforeResults.iterator(); + String beforeResult = current.next(); + for (String result : results) { + if (result.equals(beforeResult)) + identically.add(true); + } } public enum Method {