### Question:
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);  }### Answer:
@Test public void SameHeader() { HttpHeadersDiffResult result = validate( multimap("header1", "value"), multimap("header1", "value") ); System.out.print(result.asConsole()); }
@Test public void DifferingHeader() { HttpHeadersDiffResult result = validate( multimap("header1", "value"), multimap("header1", "other") ); System.out.print(result.asConsole()); }
@Test public void DuplicateHeaderThatMatches() { HttpHeadersDiffResult result = validate( multimap("header1", "value"), multimap( "header1", "value", "header1", "othervalue" ) ); System.out.print(result.asConsole()); }
@Test public void DuplicateHeaderThatDoesNotMatch() { HttpHeadersDiffResult result = validate( multimap("header1", "value"), multimap( "header1", "other", "header1", "othervalue" ) ); System.out.print(result.asConsole()); }
@Test public void SuperFluousHeader() { HttpHeadersDiffResult result = validate( multimap("header1", "value"), multimap( "header1", "value", "header2", "othervalue" ) ); System.out.print(result.asConsole()); }
@Test public void emptyHeader() { HttpHeadersDiffResult result = validate( multimap("header1", ""), multimap( "header1", "value" ) ); System.out.print(result.asConsole()); }
@Test public void missingHeader() { HttpHeadersDiffResult result = validate( multimap("header1", ""), multimap() ); System.out.print(result.asConsole()); }