-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestBase.java
More file actions
42 lines (37 loc) · 1.28 KB
/
TestBase.java
File metadata and controls
42 lines (37 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package SDK;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import org.junit.Before;
import org.mockito.Mock;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
// This is a temporary addition to ensure our unit tests are trying not instantiating an actual cassandra session. This will need
// to be replaced by proper unit testing practices moving forward
@PowerMockIgnore("javax.management.*")
public class TestBase {
@Before
public void setup() throws Exception {
}
protected String readDataFromFile(String fileName) {
StringBuilder content = new StringBuilder();
File file = new File(fileName);
try {
String strCurrentLine;
BufferedReader br = new BufferedReader(new FileReader(file));
while ((strCurrentLine = br.readLine()) != null) {
content.append(strCurrentLine);
content.append("\n");
}
br.close();
} catch (FileNotFoundException e) {
System.out.println(fileName + " not found.");
} catch (IOException e) {
System.out.println("Empty file.");
}
return content.toString();
}
}