@Test public void testPostParameterWhitelistNotMatch() throws Exception { RecordedStringHttpBody stringHttpBody1 = new RecordedStringHttpBody("a=a&b=b&c=c"); RecordedStringHttpBody stringHttpBody2 = new RecordedStringHttpBody("a=a&b=x&c=c"); Multimap<String, String> headers = LinkedHashMultimap.create(); headers.put("Content-Type", "application/x-www-form-urlencoded"); Set<String> whitelist = new HashSet<>(); whitelist.add("a"); whitelist.add("b"); RecordedHttpRequest recordedHttpRequest1 = new RecordedHttpRequest(null, null, headers, stringHttpBody1); RecordedHttpRequest recordedHttpRequest2 = new RecordedHttpRequest(null, null, headers, stringHttpBody2); MatchRule matchRule = MatchRuleUtils.matchBodyPostParametersWithWhitelist(whitelist); Assert.assertFalse(matchRule.test(recordedHttpRequest1, recordedHttpRequest2)); Assert.assertTrue(matchRule.getMatchFailureDescriptionForRequests(recordedHttpRequest1, recordedHttpRequest2).contains("HTTP Body Parameters Mismatch (with Whitelist)")); }
public static MatchRule matchBodyPostParametersWithWhitelist(Set<String> whiteList) { return new MatchBodyPostParameters(new MatchRuleWhitelistTransform(whiteList)); }
MatchRuleUtils { public static MatchRule matchBodyPostParametersWithWhitelist(Set<String> whiteList) { return new MatchBodyPostParameters(new MatchRuleWhitelistTransform(whiteList)); } }
MatchRuleUtils { public static MatchRule matchBodyPostParametersWithWhitelist(Set<String> whiteList) { return new MatchBodyPostParameters(new MatchRuleWhitelistTransform(whiteList)); } private  MatchRuleUtils(); }
MatchRuleUtils { public static MatchRule matchBodyPostParametersWithWhitelist(Set<String> whiteList) { return new MatchBodyPostParameters(new MatchRuleWhitelistTransform(whiteList)); } private  MatchRuleUtils(); static MatchRule matchEntireRequest(); static MatchRule matchMethodUri(); static MatchRule matchMethodBodyUri(); static MatchRule matchMethodUriBodyWithAnyBoundary(); static MatchRule matchUriWithQueryWhitelist(Set<String> whiteList); static MatchRule matchUriWithQueryBlacklist(Set<String> blackList); static MatchRule matchHeadersWithWhitelist(Set<String> whiteList); static MatchRule matchHeadersWithBlacklist(Set<String> blackList); static MatchRule matchBodyPostParametersWithWhitelist(Set<String> whiteList); static MatchRule matchBodyPostParametersWithBlacklist(Set<String> blackList); }
MatchRuleUtils { public static MatchRule matchBodyPostParametersWithWhitelist(Set<String> whiteList) { return new MatchBodyPostParameters(new MatchRuleWhitelistTransform(whiteList)); } private  MatchRuleUtils(); static MatchRule matchEntireRequest(); static MatchRule matchMethodUri(); static MatchRule matchMethodBodyUri(); static MatchRule matchMethodUriBodyWithAnyBoundary(); static MatchRule matchUriWithQueryWhitelist(Set<String> whiteList); static MatchRule matchUriWithQueryBlacklist(Set<String> blackList); static MatchRule matchHeadersWithWhitelist(Set<String> whiteList); static MatchRule matchHeadersWithBlacklist(Set<String> blackList); static MatchRule matchBodyPostParametersWithWhitelist(Set<String> whiteList); static MatchRule matchBodyPostParametersWithBlacklist(Set<String> blackList);  }