RecordedRequestMatcher.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:Guardian.java 作者:
private boolean matchesQueryParameter(RecordedRequest item, Description mismatchDescription) {
    String path = item.getPath();
    boolean hasQuery = path.indexOf("?") > 0;
    if (!hasQuery) {
        mismatchDescription.appendText(" query was empty");
        return false;
    }

    String query = path.substring(path.indexOf("?") + 1, path.length());
    String[] parameters = query.split("&");
    for (String p : parameters) {
        if (p.equals(String.format("%s=%s", first, second))) {
            return true;
        }
    }
    mismatchDescription.appendValueList("Query parameters were {", ", ", "}.", parameters);
    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号