class ShouldBeSorted extends BasicErrorMessageFactory {

  private ShouldBeSorted(String format, Object... arguments) {
    super(format, arguments);
  }

  /**
   * Creates a new <code>{@link ShouldBeSorted}</code>.
   * 
   * @param i the index of elements whose not naturally ordered with the next.
   * @param group the actual group in the failed assertion (either collection or an array).
   * @return an instance of {@code ErrorMessageFactory}.
   */
  public static ErrorMessageFactory shouldBeSorted(int i, Object group) {<FILL_FUNCTION_BODY>}

  public static ErrorMessageFactory shouldBeSortedAccordingToGivenComparator(int i, Object group,
                                                                             Comparator<?> comparator) {
    List<?> arrayWrapper = groupAsList(group);
    return new ShouldBeSorted(
                              "%ngroup is not sorted according to %s comparator because element %s:%n  %s%nis not less or equal than element %s:%n  %s%ngroup was:%n  %s",
                              comparator, i, arrayWrapper.get(i), i + 1, arrayWrapper.get(i + 1), arrayWrapper);
  }

  public static ErrorMessageFactory shouldHaveMutuallyComparableElements(Object actual) {
    return new ShouldBeSorted("%nsome elements are not mutually comparable in group:%n  %s", actual);
  }

  public static ErrorMessageFactory shouldHaveComparableElementsAccordingToGivenComparator(Object actual,
                                                                                           Comparator<?> comparator) {
    return new ShouldBeSorted("%nsome elements are not mutually comparable according to %s comparator in group:%n<%s>",
                              comparator, actual);
  }

  /**
   * Convert the given group (which is either an array or a Collection) to a List.
   * 
   * @param group the group to convert
   * @return the corresponding List
   * @throws IllegalArgumentException if group can't be converted to a List
   */
  @SuppressWarnings("unchecked")
  private static List<?> groupAsList(Object group) {
    if (group.getClass().isArray()) {
      return wrap(group);
    } else if (group instanceof Collection<?>) {
      return new ArrayList<>((Collection<Object>) group);
    }
    throw new IllegalArgumentException("Parameter should be an array or a collection but was " + group);
  }

}

    List<?> groupAsList = groupAsList(group);
    return new ShouldBeSorted(
                              "%ngroup is not sorted because element %s:%n  %s%nis not less or equal than element %s:%n  %s%ngroup was:%n  %s",
                              i, groupAsList.get(i), i + 1, groupAsList.get(i + 1), groupAsList);
  
<methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>protected final non-sealed java.lang.Object[] arguments,protected final non-sealed java.lang.String format,org.assertj.core.error.MessageFormatter formatter