content: /*
   * Created on Jul 25, 2010
   *
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
   * the License. You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
   * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
   * specific language governing permissions and limitations under the License.
   *
   * Copyright @2010-2013 the original author or authors.
   */
  package org.fest.assertions.core;
  
  import java.util.Comparator;
  
  /**
   * Assertions applicable to primitive arrays or arrays of elements either naturally {@link Comparable} or according to a
   * given {@link Comparator}.
   * <p>
   * Note that the contract defined here is can't be totally applied to List (that's why its name is not SortedAssert),
   * the differences being that we can't check that - for empty List - the list parameter is comparable or compatible with
   * given comparator due to type erasure.
   *
   * @param <S> the "self" type of this assertion class that must be a array type (e.g. arrays, collections).<br>
   *          Please read &quot;<a href="http://bit.ly/anMa4g" target="_blank">Emulating 'self types' using Java Generics
   *          to simplify fluent API implementation</a>&quot; for more details.
   *
   * @author Joel Costigliola
   * @author Mikhail Mazursky
   * @author Yvonne Wang
   */
  public interface ArraySortedAssert<S> {
  
    /**
     * Verifies that the actual array is sorted into ascending order according to the natural ordering of its elements.
     * <p>
     * All array elements must be primitive or implement the {@link Comparable} interface and must be mutually comparable
     * (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array), examples :
     * <ul>
     * <li>a array composed of {2, 4, 6} is ok because the element type is a primitive type.</li>
     * <li>a array composed of {"a1", "a2", "a3"} is ok because the element type (String) is Comparable</li>
     * <li>a array composed of Rectangle {r1, r2, r3} is <b>NOT ok</b> because Rectangle is not Comparable</li>
     * <li>a array composed of {True, "abc", False} is <b>NOT ok</b> because elements are not mutually comparable (even
     * though each element type implements Comparable)</li>
     * </ul>
     * Empty or one element arrays are considered sorted (unless the array element type is not Comparable).</br></br>
     *
     * @return {@code this} assertion object.
     *
     * @throws AssertionError if the actual array is not sorted into ascending order according to the natural ordering of
     *           its elements.
     * @throws AssertionError if the actual array is <code>null</code>.
     * @throws AssertionError if the actual array element type does not implement {@link Comparable}.
     * @throws AssertionError if the actual array elements are not mutually {@link Comparable}.
     */
    S isSorted();
  }
  