Updated methods to use path insetad of file from java.nio
This commit is contained in:
@@ -4,6 +4,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -48,7 +49,7 @@ public class FileReaderTest {
|
||||
@Test
|
||||
public void testForLoop() {
|
||||
Integer lineCount = 0;
|
||||
for(LineInfo s : new FileReader(new File(TEST_FILE))) {
|
||||
for(LineInfo s : new FileReader(Paths.get(TEST_FILE))) {
|
||||
lineCount++;
|
||||
Integer lineNumber = s.getLineNumber();
|
||||
Integer lineLength = s.getLine().length();
|
||||
@@ -62,7 +63,7 @@ public class FileReaderTest {
|
||||
public void testIterator() {
|
||||
Integer lineCount = 0;
|
||||
|
||||
try(AutoCloseableIterator<LineInfo> iter = new FileReader(new File(TEST_FILE))) {
|
||||
try(AutoCloseableIterator<LineInfo> iter = new FileReader(Paths.get(TEST_FILE))) {
|
||||
while(iter.hasNext()) {
|
||||
lineCount++;
|
||||
LineInfo s = iter.next();
|
||||
@@ -78,7 +79,7 @@ public class FileReaderTest {
|
||||
@Test
|
||||
public void testForIterator() {
|
||||
Integer lineCount = 0;
|
||||
for(Iterator<LineInfo> iter = new FileReader(new File(TEST_FILE)); iter.hasNext();) {
|
||||
for(Iterator<LineInfo> iter = new FileReader(Paths.get(TEST_FILE)); iter.hasNext();) {
|
||||
lineCount++;
|
||||
LineInfo s = iter.next();
|
||||
Integer lineNumber = s.getLineNumber();
|
||||
|
@@ -4,6 +4,8 @@ import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
@@ -107,7 +109,7 @@ public class PropertiesManagerTest {
|
||||
public void testSaveConfiguration() {
|
||||
try {
|
||||
Properties props = PropertiesManager.loadConfiguration(this.getClass(), PROPERTIES_FILE);
|
||||
File tmpFile = new File(TMP_PROPS);
|
||||
Path tmpFile = Paths.get(TMP_PROPS);
|
||||
PropertiesManager.saveConfiguration(props, tmpFile, "test propertis");
|
||||
Properties tmp = PropertiesManager.loadConfiguration(tmpFile);
|
||||
assertTrue(tmp.keySet().size() == ENTRY_SIZE);
|
||||
|
Reference in New Issue
Block a user