diff options
Diffstat (limited to 'metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java')
-rw-r--r-- | metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java new file mode 100644 index 00000000000..c5104d65b26 --- /dev/null +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java @@ -0,0 +1,36 @@ +/* + * Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + */ + +package ai.vespa.metricsproxy; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +/** + * Utilities for tests in this module. + * + * @author hmusum + */ +public class TestUtil { + + public static String getContents(File aFile) { + //...checks on aFile are elided + StringBuilder contents = new StringBuilder(); + + try (BufferedReader input = new BufferedReader(new FileReader(aFile))) { + String line; + while ((line = input.readLine()) != null) { + contents.append(line); + contents.append(System.getProperty("line.separator")); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + + return contents.toString(); + } + +} |