### Question:
SortUser { public List<User> sortNameLength(List<User> list) { list.sort( new Comparator<User>() { @Override public int compare(User o1, User o2) { return o1.getName().length() - o2.getName().length(); } } ); return list; }  Set<User> sort(List<User> list); List<User> sortNameLength(List<User> list); List<User> sortByAllFields(List<User> list);  }### Answer:
@Test public void ifSortUsersListByNameLengthThenReturnSortedList() { User first = new User("Egor", 10); User second = new User("Roman", 25); User third = new User("Vasiliy", 20); SortUser testSort = new SortUser(); List<User> result = testSort.sortNameLength(new ArrayList<>(asList(first, third, second))); List<User> expect = new ArrayList<>(asList(first, second, third)); assertThat(result, is(expect)); }