< prev index next >

test/testlibrary/com/oracle/java/testlibrary/Asserts.java

Print this page
rev 8910 : full patch for jfr

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -434,10 +434,28 @@
         if (stringsAreDifferent) {
             error(messageBuilder.toString());
         }
     }
 
+    /**
+     * Fail the test directly
+     * @throws RuntimeException anyway.
+     */
+    public static void fail() {
+        error("Failed");
+    }
+
+    /**
+     * Fails a test with the given message.
+     *
+     * @param msg A description of the failure.
+     *
+     */
+    public static void fail(String msg) {
+        error(msg);
+    }
+
     private static <T extends Comparable<T>> int compare(T lhs, T rhs, String msg) {
         assertNotNull(lhs, msg);
         assertNotNull(rhs, msg);
         return lhs.compareTo(rhs);
     }
< prev index next >