langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java
changeset 19920 ead15bfdcfa0
parent 14262 058238ba531e
child 23971 f5ff1f5a8dee
--- a/langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java	Wed Sep 04 11:53:09 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java	Wed Sep 04 14:44:05 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8000418
+ * @bug 8000418 8024288
  * @summary Verify that files use a common Generated By string
  * @library ../lib/
  * @build JavadocTester TestGeneratedBy
@@ -50,32 +50,44 @@
         "index.html"
     };
 
-    private static final String[] ARGS =
+    private static final String[] STD_ARGS =
         new String[] {
             "-d", OUTPUT_DIR,
             "-sourcepath", SRC_DIR,
             "pkg"
         };
-    private static final String BUG_ID = "8000418";
 
-    private static String[][] getTests() {
+    private static final String[] NO_TIMESTAMP_ARGS =
+        new String[] {
+            "-notimestamp",
+            "-d", OUTPUT_DIR,
+            "-sourcepath", SRC_DIR,
+            "pkg"
+        };
+
+    private static final String BUG_ID = "8000418-8024288";
+
+    private static String[][] getTests(boolean timestamp) {
         String version = System.getProperty("java.version");
         String[][] tests = new String[FILES.length][];
         for (int i = 0; i < FILES.length; i++) {
+            String genBy = "Generated by javadoc";
+            if (timestamp) genBy += " (" + version + ") on ";
             tests[i] = new String[] {
-                OUTPUT_DIR + FS + FILES[i],
-                "Generated by javadoc (" + version + ") on "
+                OUTPUT_DIR + FS + FILES[i], genBy
             };
         }
         return tests;
     }
 
-    private static String[][] getNegatedTests() {
+    private static String[][] getNegatedTests(boolean timestamp) {
         String[][] tests = new String[FILES.length][];
         for (int i = 0; i < FILES.length; i++) {
             tests[i] = new String[] {
                 OUTPUT_DIR + FS + FILES[i],
-                "Generated by javadoc (version",
+                (timestamp
+                    ? "Generated by javadoc (version"
+                    : "Generated by javadoc ("),
                 "Generated by javadoc on"
             };
         }
@@ -88,9 +100,10 @@
      */
     public static void main(String[] args) {
         TestGeneratedBy tester = new TestGeneratedBy();
-        int exitCode = run(tester, ARGS, getTests(), getNegatedTests());
+        int ec1 = run(tester, STD_ARGS, getTests(true), getNegatedTests(true));
+        int ec2 = run(tester, NO_TIMESTAMP_ARGS, getTests(false), getNegatedTests(false));
         tester.printSummary();
-        if (exitCode != 0) {
+        if (ec1 != 0 || ec2 != 0) {
             throw new Error("Error found while executing Javadoc");
         }
     }