8222713: Add OutputAnalyzer(Path) constructor
authorstefank
Thu, 18 Apr 2019 09:27:28 +0200
changeset 54575 84054d68bf85
parent 54574 7b74bbe5085b
child 54576 aa626cbadf1b
8222713: Add OutputAnalyzer(Path) constructor Reviewed-by: dholmes, coleenp
test/lib/jdk/test/lib/process/OutputAnalyzer.java
--- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java	Wed Apr 17 07:41:09 2019 +0200
+++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java	Thu Apr 18 09:27:28 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,6 +27,8 @@
 
 import java.io.IOException;
 import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -59,6 +61,15 @@
     /**
      * Create an OutputAnalyzer, a utility class for verifying output
      *
+     * @param file File to analyze
+     */
+    public OutputAnalyzer(Path file) throws IOException {
+        this(Files.readString(file));
+    }
+
+    /**
+     * Create an OutputAnalyzer, a utility class for verifying output
+     *
      * @param stdout stdout buffer to analyze
      * @param stderr stderr buffer to analyze
      */