@Test
public void sortByNameAndValuesShouldSort(){

    List<? extends EncodedPair> expected = asList(
            new SimpleEncodedPair("a", "aa"),
            new SimpleEncodedPair("a", "ab"),
            new SimpleEncodedPair("aa", "aa"),
            new SimpleEncodedPair("aa", "ab"),
            new SimpleEncodedPair("ab", ""),
            new SimpleEncodedPair("ab", "00"),
            new SimpleEncodedPair("ab", "01")
    );
    List<? extends EncodedPair> toSort = new ArrayList<EncodedPair>(expected);
    Collections.shuffle(toSort);
    List<? extends EncodedPair> toSortOriginal = new ArrayList<EncodedPair>(toSort);
    List<EncodedPair> actual = Pairs.sortByNameAndValues(toSort);
    assertEquals(toSortOriginal, toSort);
    assertEquals(expected, actual);
}