Pair { @Override public String toString() { return "First: \""+first.toString()+"\" Second: \""+second.toString()+"\""; } Pair(F first, S second); static Pair<F, S> create(F f, S s); @Override boolean equals(java.lang.Object o); @Override String toString(); @Override int hashCode(); final F first; final S second; }
@Test public void toStringTest() { Pair pair = Pair.create("the-first", "2nd"); assertThat(pair.toString(), containsString("the-first")); assertThat(pair+"", containsString("2nd")); }