Updated file test
Some checks failed
Locusworks Team/commons/pipeline/head There was a failure building this commit
Some checks failed
Locusworks Team/commons/pipeline/head There was a failure building this commit
This commit is contained in:
@ -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; }
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -49,13 +49,15 @@ public class FileReaderTest {
|
||||
@Test
|
||||
public void testForLoop() {
|
||||
Integer lineCount = 0;
|
||||
for(LineInfo s : new FileReader(Paths.get(TEST_FILE))) {
|
||||
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());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user