Updated file test
Some checks failed
Locusworks Team/commons/pipeline/head There was a failure building this commit

This commit is contained in:
Isaac Parenteau
2020-05-22 23:16:55 -05:00
parent 526a5b3dbd
commit c7c3f3c6bd
3 changed files with 10 additions and 8 deletions

View File

@ -89,7 +89,7 @@ public class KeyFile implements AutoCloseable {
try {
this.key = ksh.isPrivate() ? kf.generatePrivateKey(ksh.getKeySpec()) : kf.generatePublicKey(ksh.getKeySpec());
this.encryptionType = ksh.getEncryptionType();
return;
break;
} catch (NullPointerException | InvalidKeySpecException ikse) { continue; }
}

View File

@ -20,7 +20,7 @@ import net.locusworks.common.interfaces.AutoCloseableIterator;
* @version 1.0.0
* @date 02/15/2018
*/
public class FileReader implements AutoCloseableIterator<FileReader.LineInfo>, Iterable<FileReader.LineInfo> {
public class FileReader implements AutoCloseableIterator<FileReader.LineInfo>, Iterable<FileReader.LineInfo>, AutoCloseable {
private BufferedReader reader;
private LineInfo info;

View File

@ -49,12 +49,14 @@ public class FileReaderTest {
@Test
public void testForLoop() {
Integer lineCount = 0;
for(LineInfo s : new FileReader(Paths.get(TEST_FILE))) {
lineCount++;
Integer lineNumber = s.getLineNumber();
Integer lineLength = s.getLine().length();
Integer mapLineLength = numLines.get(lineNumber);
assertTrue(lineLength == (mapLineLength-1));
try (FileReader fr = new FileReader(Paths.get(TEST_FILE))) {
for (LineInfo s : fr) {
lineCount++;
Integer lineNumber = s.getLineNumber();
Integer lineLength = s.getLine().length();
Integer mapLineLength = numLines.get(lineNumber);
assertTrue(lineLength == (mapLineLength-1));
}
}
assertTrue(lineCount == numLines.size());
}