Commit 4f742512 authored by Greg Messner's avatar Greg Messner
Browse files

Renamed to remove Test from the class name.

parent 75a24c23
...@@ -4,29 +4,9 @@ import java.io.File; ...@@ -4,29 +4,9 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.Reader;
import java.util.Properties; import java.util.Properties;
public class TestUtils { public class HelperUtils {
/**
* Reads the content of a Reader instance and returns it as a String.
*
* @param reader
* @return the content of a Reader instance as a String
* @throws IOException
*/
public static String getReaderContentAsString(Reader reader) throws IOException {
int count;
final char[] buffer = new char[2048];
final StringBuilder out = new StringBuilder();
while ((count = reader.read(buffer, 0, buffer.length)) >= 0) {
out.append(buffer, 0, count);
}
return (out.toString());
}
private static Properties testProperties; private static Properties testProperties;
static { static {
...@@ -39,17 +19,23 @@ public class TestUtils { ...@@ -39,17 +19,23 @@ public class TestUtils {
basedir = basedir.substring(0, basedir.length() - 15); basedir = basedir.substring(0, basedir.length() - 15);
} }
File propertiesFile = new File(basedir, "test-gitlab4j.properties"); File propertiesFile = new File((String) System.getProperties().get("user.home"), "test-gitlab4j.properties");
if (!propertiesFile.exists()) { if (!propertiesFile.exists()) {
propertiesFile = new File((String) System.getProperties().get("user.home"), "test-gitlab4j.properties"); propertiesFile = new File(basedir, "src/test/gitlab/test-gitlab4j.properties");
} }
System.out.println("test-gitlab4j.properties location: " + propertiesFile.getAbsolutePath()); if (propertiesFile.exists()) {
System.out.println("test-gitlab4j.properties location: " + propertiesFile.getAbsolutePath());
testProperties = new Properties(); testProperties = new Properties();
try (InputStream input = new FileInputStream(propertiesFile)) { try (InputStream input = new FileInputStream(propertiesFile)) {
testProperties.load(input); testProperties.load(input);
} catch (IOException ioe) { } catch (IOException ioe) {
}
} else {
System.out.println("No test-gitlab4j.properties file found");
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment