< prev index next >

test/lib/testlibrary/jdk/testlibrary/Asserts.java

Print this page




  27 
  28 /**
  29  * Asserts that can be used for verifying assumptions in tests.
  30  *
  31  * An assertion will throw a {@link RuntimeException} if the assertion isn't true.
  32  * All the asserts can be imported into a test by using a static import:
  33  *
  34  * <pre>
  35  * {@code
  36  * import static jdk.testlibrary.Asserts.*;
  37  * }
  38  *
  39  * Always provide a message describing the assumption if the line number of the
  40  * failing assertion isn't enough to understand why the assumption failed. For
  41  * example, if the assertion is in a loop or in a method that is called
  42  * multiple times, then the line number won't provide enough context to
  43  * understand the failure.
  44  * </pre>
  45  *
  46  * @deprecated This class is deprecated. Use the one from
  47  *             {@code <root>/test/lib/share/classes/jdk/test/lib}
  48  */
  49 @Deprecated
  50 public class Asserts {
  51 
  52     /**
  53      * Shorthand for {@link #assertLessThan(Comparable, Comparable)}.
  54      *
  55      * @param <T> a type
  56      * @param lhs The left hand side of the comparison.
  57      * @param rhs The right hand side of the comparison.
  58      * @see #assertLessThan(Comparable, Comparable)
  59      */
  60     public static <T extends Comparable<T>> void assertLT(T lhs, T rhs) {
  61         assertLessThan(lhs, rhs);
  62     }
  63 
  64     /**
  65      * Shorthand for {@link #assertLessThan(Comparable, Comparable, String)}.
  66      *
  67      * @param <T> a type




  27 
  28 /**
  29  * Asserts that can be used for verifying assumptions in tests.
  30  *
  31  * An assertion will throw a {@link RuntimeException} if the assertion isn't true.
  32  * All the asserts can be imported into a test by using a static import:
  33  *
  34  * <pre>
  35  * {@code
  36  * import static jdk.testlibrary.Asserts.*;
  37  * }
  38  *
  39  * Always provide a message describing the assumption if the line number of the
  40  * failing assertion isn't enough to understand why the assumption failed. For
  41  * example, if the assertion is in a loop or in a method that is called
  42  * multiple times, then the line number won't provide enough context to
  43  * understand the failure.
  44  * </pre>
  45  *
  46  * @deprecated This class is deprecated. Use the one from
  47  *             {@code <root>/test/lib/jdk/test/lib}
  48  */
  49 @Deprecated
  50 public class Asserts {
  51 
  52     /**
  53      * Shorthand for {@link #assertLessThan(Comparable, Comparable)}.
  54      *
  55      * @param <T> a type
  56      * @param lhs The left hand side of the comparison.
  57      * @param rhs The right hand side of the comparison.
  58      * @see #assertLessThan(Comparable, Comparable)
  59      */
  60     public static <T extends Comparable<T>> void assertLT(T lhs, T rhs) {
  61         assertLessThan(lhs, rhs);
  62     }
  63 
  64     /**
  65      * Shorthand for {@link #assertLessThan(Comparable, Comparable, String)}.
  66      *
  67      * @param <T> a type


< prev index next >