@Test public void shiftMulEncTest() throws IOException, InvalidEncryptionKeyException { // Encryption - ShiftMultiplyEncryption doubleEncryption.setAlgorithem(alg2); doubleEncryption.encryptFile(TEST_INPUT3, TEST_OUT_PATH, TEST_KEY2); String expected = fs.readFile(TEST_OUT_PATH); String actual = TI4; assertEquals(expected, actual); }
@Test public void shiftUpDecTest() throws IOException, InvalidEncryptionKeyException { // Decryption - ShiftUpEncryption doubleEncryption.decryptFile(TEST_INPUT2, TEST_OUT_PATH_2, TEST_KEY); String expected = fs.readFile(TEST_OUT_PATH_2); String actual = TI1; assertEquals(expected, actual); }
@Test(expected = InvalidEncryptionKeyException.class) public void InvalidEncryptionKeyExceptionTest3() throws IOException, InvalidEncryptionKeyException { // InvalidEncryptionKeyException - Too bigger key File toFile = new File(KET_EXP0_PATH); if (!toFile.exists()) { boolean success = toFile.createNewFile(); } FileWriter outFileWriter = new FileWriter(toFile); BufferedWriter bw = new BufferedWriter(outFileWriter); bw.write("5"); bw.close(); doubleEncryption.encryptFile(TEST_INPUT, TEST_OUT_PATH, KET_EXP0_PATH); }
@Test(expected = InvalidEncryptionKeyException.class) public void InvalidEncryptionKeyExceptionTest1() throws IOException, InvalidEncryptionKeyException { // InvalidEncryptionKeyException - Non numeric key doubleEncryption.encryptFile(TEST_INPUT, TEST_OUT_PATH, TEST_OUT_PATH); }
@Test(expected = InvalidEncryptionKeyException.class) public void InvalidEncryptionKeyExceptionTest2() throws IOException, InvalidEncryptionKeyException { // InvalidEncryptionKeyException - Too bigger key doubleEncryption.encryptFile(TEST_INPUT, TEST_OUT_PATH, TEST_KEY3); }