Last active
October 1, 2015 19:18
-
-
Save richashworth/2043554 to your computer and use it in GitHub Desktop.
Used as dependency in PowerMock Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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