changeset 416:32d7d4da95be

7902109: UX: Add description to failure message if it is available Contributed-by: Ivan Sopov <sopov.ivan@gmail.com>
author shade
date Thu, 25 Jan 2018 12:35:51 +0100
parents 18db5d6682d7
children 64f2cf32fa0a
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/TestGrading.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/TestGrading.java	Thu Nov 16 16:45:28 2017 +0100
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/TestGrading.java	Thu Jan 25 12:35:51 2018 +0100
@@ -90,7 +90,7 @@
             Expect ex = matched.expect();
             isPassed &= passed(ex, count);
             hasInteresting |= hasInteresting(ex, count);
-            failureMessages.add(failureMessage(s, ex, count));
+            failureMessages.add(failureMessage(s, ex, count, matched.description()));
 
             gradingResults.add(new GradingResult(
                     s,
@@ -105,7 +105,7 @@
             Expect ex = c.expect();
             isPassed &= passed(ex, 0);
             hasInteresting |= hasInteresting(ex, 0);
-            failureMessages.add(failureMessage("N/A", ex, 0));
+            failureMessages.add(failureMessage("N/A", ex, 0, c.description()));
 
             gradingResults.add(new GradingResult(
                     c.matchPattern(),
@@ -119,7 +119,7 @@
                 Comparator.comparing(c -> c.id));
     }
 
-    public static String failureMessage(String id, Expect expect, long count) {
+    public static String failureMessage(String id, Expect expect, long count, String description) {
         if (passed(expect, count)) {
             return null;
         } else {
@@ -128,7 +128,7 @@
                 case ACCEPTABLE_INTERESTING:
                     return null;
                 case FORBIDDEN:
-                    return "Observed forbidden state: " + id;
+                    return "Observed forbidden state: " + id + (description == null ? "" : " (" + description + ")");
                 case UNKNOWN:
                     return "Missing description";
                 default: