8220693: jdk/javadoc/doclet/MetaTag/MetaTag.java with unexpected date
authorjjg
Mon, 18 Mar 2019 11:50:57 -0700
changeset 54181 d265655be483
parent 54180 564043cbe138
child 54182 2e586b74722e
8220693: jdk/javadoc/doclet/MetaTag/MetaTag.java with unexpected date Reviewed-by: hannesw
test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java
--- a/test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java	Mon Mar 18 17:33:59 2019 +0100
+++ b/test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java	Mon Mar 18 11:50:57 2019 -0700
@@ -93,14 +93,19 @@
                 "<meta name=\"keywords\" content=\"Overview, Sample Packages\">");
 
         // NOTE: Hopefully, this regression test is not run at midnight.  If the output
-        // was generated yesterday and this test is run today, the test will fail.
-        checkOutput("overview-summary.html", found,
-                "<meta name=\"" + metaNameDate + "\" content=\"" + date() + "\">");
+        // was generated yesterday and this test is run today, this check could fail ...
+        // so make sure the date has not changed since the test started
+        String date = date();
+        if (date.equals(startDate)) {
+            checkOutput("overview-summary.html", found,
+                    "<meta name=\"" + metaNameDate + "\" content=\"" + date + "\">");
+        }
     }
 
     private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+    private static final String startDate = date();
 
-    String date() {
+    static String date() {
         return dateFormat.format(new Date());
     }
 }