X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Ftest_code%2FCryptUtilsTest.java;h=0c53461ea56aed8c5959e4b834ac90306994c8f4;hb=28bee1c360ac061db48395356f36ef62c2923bf1;hp=61e18fbb49198ec36240d361a9d16d13a44af7c3;hpb=6fd1a061ff06f14552deaf0e20aa21cee07a396d;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/test_code/CryptUtilsTest.java b/src/be/nikiroo/utils/test_code/CryptUtilsTest.java index 61e18fb..0c53461 100644 --- a/src/be/nikiroo/utils/test_code/CryptUtilsTest.java +++ b/src/be/nikiroo/utils/test_code/CryptUtilsTest.java @@ -75,8 +75,8 @@ class CryptUtilsTest extends TestLauncher { @Override public void test() throws Exception { String orig = "data"; - String encrypted = crypt.encrypt64(orig, false); - String decrypted = crypt.decrypt64s(encrypted, false); + String encrypted = crypt.encrypt64(orig); + String decrypted = crypt.decrypt64s(encrypted); assertEquals(orig, decrypted); } @@ -97,8 +97,8 @@ class CryptUtilsTest extends TestLauncher { @Override public void test() throws Exception { String orig = ""; - String encrypted = crypt.encrypt64(orig, false); - String decrypted = crypt.decrypt64s(encrypted, false); + String encrypted = crypt.encrypt64(orig); + String decrypted = crypt.decrypt64s(encrypted); assertEquals(orig, decrypted); } @@ -119,8 +119,8 @@ class CryptUtilsTest extends TestLauncher { @Override public void test() throws Exception { String orig = longData; - String encrypted = crypt.encrypt64(orig, false); - String decrypted = crypt.decrypt64s(encrypted, false); + String encrypted = crypt.encrypt64(orig); + String decrypted = crypt.decrypt64s(encrypted); assertEquals(orig, decrypted); } @@ -135,15 +135,17 @@ class CryptUtilsTest extends TestLauncher { addTest(new TestCase("Simple test") { @Override public void test() throws Exception { - InputStream in = new ByteArrayInputStream(new byte[] {42, 127, 12}); - crypt.encryptInputStream(in); + InputStream in = new ByteArrayInputStream(new byte[] { 42, 127, + 12 }); + crypt.encrypt(in); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.write(in, out); byte[] result = out.toByteArray(); - - assertEquals("We wrote 3 bytes, we expected 3 bytes back but got: " - + result.length, result.length, result.length); - + + assertEquals( + "We wrote 3 bytes, we expected 3 bytes back but got: " + + result.length, result.length, result.length); + assertEquals(42, result[0]); assertEquals(127, result[1]); assertEquals(12, result[2]);