Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Used as dependency in PowerMock Example
package com.richashworth.powermockexample;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;
import static com.google.common.io.Files.readLines;
public final class DataProvider {
public static List<String> getData() {
List<String> data = null;
try {
data = new DataProvider().readFile();
} catch (IOException e) {
e.printStackTrace();
}
return data;
}
private static List<String> readFile() throws IOException {
File file = new File("/some/path/to/file");
List<String> lines = readLines(file, Charset.forName("utf-8"));
return lines;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment