|
@@ -1,11 +1,10 @@
|
1
|
1
|
import org.junit.Assert;
|
2
|
2
|
import org.junit.Test;
|
3
|
3
|
|
4
|
|
-import java.io.BufferedReader;
|
5
|
|
-import java.io.FileNotFoundException;
|
|
4
|
+import java.io.BufferedReader;;
|
6
|
5
|
import java.io.FileReader;
|
|
6
|
+import java.io.IOException;
|
7
|
7
|
|
8
|
|
-import static org.junit.Assert.*;
|
9
|
8
|
|
10
|
9
|
public class AtbashCipherTest {
|
11
|
10
|
|
|
@@ -21,7 +20,7 @@ public class AtbashCipherTest {
|
21
|
20
|
}
|
22
|
21
|
|
23
|
22
|
@Test
|
24
|
|
- public void testFiles() throws FileNotFoundException {
|
|
23
|
+ public void testFiles() throws IOException {
|
25
|
24
|
|
26
|
25
|
AtbashCipher cipher = new AtbashCipher();
|
27
|
26
|
|
|
@@ -32,8 +31,16 @@ public class AtbashCipherTest {
|
32
|
31
|
cipher.cipherFile(inputFile, outputTest);
|
33
|
32
|
cipher.cipherFile(outputTest, decryptTest);
|
34
|
33
|
|
35
|
|
- FileReader fReader = new FileReader(inputFile);
|
36
|
|
- BufferedReader bufferedReader = new BufferedReader(fReader);
|
|
34
|
+ BufferedReader bROriginal = new BufferedReader(new FileReader(inputFile));
|
|
35
|
+ BufferedReader bRDecyphered = new BufferedReader(new FileReader(decryptTest));
|
|
36
|
+
|
|
37
|
+ String originalLine;
|
|
38
|
+ String decrpytLine;
|
|
39
|
+
|
|
40
|
+ while ((originalLine = bROriginal.readLine()) != null) {
|
|
41
|
+ decrpytLine = bRDecyphered.readLine();
|
|
42
|
+ Assert.assertEquals(originalLine, decrpytLine);
|
|
43
|
+ }
|
37
|
44
|
|
38
|
45
|
|
39
|
46
|
}
|