|
@@ -0,0 +1,35 @@
|
|
1
|
+import org.testng.annotations.Test;
|
|
2
|
+
|
|
3
|
+import java.io.FileNotFoundException;
|
|
4
|
+
|
|
5
|
+import static org.testng.Assert.assertEquals;
|
|
6
|
+import static org.testng.Assert.assertTrue;
|
|
7
|
+
|
|
8
|
+public class FileEncryptTest {
|
|
9
|
+
|
|
10
|
+ @Test
|
|
11
|
+ public void testFileEncrypt() throws FileNotFoundException {
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+ String expected="Funyy V pbzcner gurr gb n fhzzre’f qnl?\n" +
|
|
15
|
+ "Gubh neg zber ybiryl naq zber grzcrengr:\n" +
|
|
16
|
+ "Ebhtu jvaqf qb funxr gur qneyvat ohqf bs Znl,\n" +
|
|
17
|
+ "Naq fhzzre’f yrnfr ungu nyy gbb fubeg n qngr;\n" +
|
|
18
|
+ "Fbzrgvzr gbb ubg gur rlr bs urnira fuvarf,\n" +
|
|
19
|
+ "Naq bsgra vf uvf tbyq pbzcyrkvba qvzz'q;\n" +
|
|
20
|
+ "Naq rirel snve sebz snve fbzrgvzr qrpyvarf,\n" +
|
|
21
|
+ "Ol punapr be angher’f punatvat pbhefr hagevzz'q;\n" +
|
|
22
|
+ "Ohg gul rgreany fhzzre funyy abg snqr,\n" +
|
|
23
|
+ "Abe ybfr cbffrffvba bs gung snve gubh bj’fg;\n" +
|
|
24
|
+ "Abe funyy qrngu oent gubh jnaqre’fg va uvf funqr,\n" +
|
|
25
|
+ "Jura va rgreany yvarf gb gvzr gubh tebj’fg:\n" +
|
|
26
|
+ " Fb ybat nf zra pna oerngur be rlrf pna frr,\n" +
|
|
27
|
+ " Fb ybat yvirf guvf, naq guvf tvirf yvsr gb gurr.";
|
|
28
|
+
|
|
29
|
+ String actual=ROT13.encrpttextfile();
|
|
30
|
+
|
|
31
|
+ assertEquals(actual, expected);
|
|
32
|
+
|
|
33
|
+ }
|
|
34
|
+
|
|
35
|
+}
|