@Test public void DifferingHeader() { HttpHeadersDiffResult result = validate( multimap("header1", "value"), multimap("header1", "other") ); System.out.print(result.asConsole()); }
public static HttpHeadersDiffResult validate(LinkedListMultimap<String, String> expectation, LinkedListMultimap<String, String> reality) { final HttpHeadersDiffResult result = new HttpHeadersDiffResult(); for (String fieldName : expectation.keySet()) { if (expectation.get(fieldName).size() > 1) { result.addMultiHeaderExpectation(fieldName); } } Map<String, DoDiff> diffResults = new HashMap<>(); for (String key : reality.keySet()) { diffResults.put(key, new DoDiff(expectation.get(key), reality.get(key))); } for (Map.Entry<String, String> actual : reality.entries()) { result.add(actual.getKey(), diffResults.get(actual.getKey()).getNextResult()); } for (String key : expectation.keySet()) { if (!reality.containsKey(key)) { result.add(key, new MissingPropertyDiffResult(expectation.get(key).get(0))); } } return result; }
ExpectedHeadersAreEqualValidator { public static HttpHeadersDiffResult validate(LinkedListMultimap<String, String> expectation, LinkedListMultimap<String, String> reality) { final HttpHeadersDiffResult result = new HttpHeadersDiffResult(); for (String fieldName : expectation.keySet()) { if (expectation.get(fieldName).size() > 1) { result.addMultiHeaderExpectation(fieldName); } } Map<String, DoDiff> diffResults = new HashMap<>(); for (String key : reality.keySet()) { diffResults.put(key, new DoDiff(expectation.get(key), reality.get(key))); } for (Map.Entry<String, String> actual : reality.entries()) { result.add(actual.getKey(), diffResults.get(actual.getKey()).getNextResult()); } for (String key : expectation.keySet()) { if (!reality.containsKey(key)) { result.add(key, new MissingPropertyDiffResult(expectation.get(key).get(0))); } } return result; } }
ExpectedHeadersAreEqualValidator { public static HttpHeadersDiffResult validate(LinkedListMultimap<String, String> expectation, LinkedListMultimap<String, String> reality) { final HttpHeadersDiffResult result = new HttpHeadersDiffResult(); for (String fieldName : expectation.keySet()) { if (expectation.get(fieldName).size() > 1) { result.addMultiHeaderExpectation(fieldName); } } Map<String, DoDiff> diffResults = new HashMap<>(); for (String key : reality.keySet()) { diffResults.put(key, new DoDiff(expectation.get(key), reality.get(key))); } for (Map.Entry<String, String> actual : reality.entries()) { result.add(actual.getKey(), diffResults.get(actual.getKey()).getNextResult()); } for (String key : expectation.keySet()) { if (!reality.containsKey(key)) { result.add(key, new MissingPropertyDiffResult(expectation.get(key).get(0))); } } return result; }  }
ExpectedHeadersAreEqualValidator { public static HttpHeadersDiffResult validate(LinkedListMultimap<String, String> expectation, LinkedListMultimap<String, String> reality) { final HttpHeadersDiffResult result = new HttpHeadersDiffResult(); for (String fieldName : expectation.keySet()) { if (expectation.get(fieldName).size() > 1) { result.addMultiHeaderExpectation(fieldName); } } Map<String, DoDiff> diffResults = new HashMap<>(); for (String key : reality.keySet()) { diffResults.put(key, new DoDiff(expectation.get(key), reality.get(key))); } for (Map.Entry<String, String> actual : reality.entries()) { result.add(actual.getKey(), diffResults.get(actual.getKey()).getNextResult()); } for (String key : expectation.keySet()) { if (!reality.containsKey(key)) { result.add(key, new MissingPropertyDiffResult(expectation.get(key).get(0))); } } return result; }  static HttpHeadersDiffResult validate(LinkedListMultimap<String, String> expectation,
                                        LinkedListMultimap<String, String> reality); }
ExpectedHeadersAreEqualValidator { public static HttpHeadersDiffResult validate(LinkedListMultimap<String, String> expectation, LinkedListMultimap<String, String> reality) { final HttpHeadersDiffResult result = new HttpHeadersDiffResult(); for (String fieldName : expectation.keySet()) { if (expectation.get(fieldName).size() > 1) { result.addMultiHeaderExpectation(fieldName); } } Map<String, DoDiff> diffResults = new HashMap<>(); for (String key : reality.keySet()) { diffResults.put(key, new DoDiff(expectation.get(key), reality.get(key))); } for (Map.Entry<String, String> actual : reality.entries()) { result.add(actual.getKey(), diffResults.get(actual.getKey()).getNextResult()); } for (String key : expectation.keySet()) { if (!reality.containsKey(key)) { result.add(key, new MissingPropertyDiffResult(expectation.get(key).get(0))); } } return result; }  static HttpHeadersDiffResult validate(LinkedListMultimap<String, String> expectation,
                                        LinkedListMultimap<String, String> reality);  }