diff options
Diffstat (limited to 'common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java')
-rw-r--r-- | common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java new file mode 100644 index 0000000000..397db374bb --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java @@ -0,0 +1,175 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 09:07:10 GMT 2016 + */ + +package org.openecomp.mso.utils; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class CryptoUtilsESTest extends CryptoUtilsESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + CryptoUtils.decrypt("E08682BE5F2B18A6E8437A15B110D418E08682BE5F2B18A6E8437A15B110D4180143DB63EE66B0CDFF9F69917680151E", "00000000000000000000000000000000"); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + byte[] byteArray0 = new byte[0]; + CryptoUtils.byteArrayToHexString(byteArray0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.encrypt("AES", "w^p&|^Cvs@K.@@"); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"w^\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.encrypt((String) null, "B2000000000000000000000000000000"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + try { + CryptoUtils.decrypt("B20000000000000000000000000000000000000000000000", "B20000000000000000000000000000000000000000000000"); + fail("Expecting exception: IllegalBlockSizeException"); + + } catch(IllegalBlockSizeException e) { + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + try { + CryptoUtils.decrypt("0000C200000000000000000000000000", "0000C200000000000000000000000000"); + fail("Expecting exception: BadPaddingException"); + + } catch(BadPaddingException e) { + } + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.decrypt("s.", "s."); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"s.\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.decrypt("", ""); + fail("Expecting exception: IllegalArgumentException"); + + } catch(IllegalArgumentException e) { + // + // Empty key + // + verifyException("javax.crypto.spec.SecretKeySpec", e); + } + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.byteArrayToHexString((byte[]) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + byte[] byteArray0 = new byte[16]; + byteArray0[0] = (byte) (-78); + String string0 = CryptoUtils.byteArrayToHexString(byteArray0); + assertEquals("B2000000000000000000000000000000", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + String string0 = CryptoUtils.encrypt("00000000000000000000000000000000", "00000000000000000000000000000000"); + assertEquals("E08682BE5F2B18A6E8437A15B110D418E08682BE5F2B18A6E8437A15B110D4180143DB63EE66B0CDFF9F69917680151E", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.encrypt("", ""); + fail("Expecting exception: IllegalArgumentException"); + + } catch(IllegalArgumentException e) { + // + // Empty key + // + verifyException("javax.crypto.spec.SecretKeySpec", e); + } + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + CryptoUtils cryptoUtils0 = new CryptoUtils(); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.decrypt((String) null, "00000000000000000000000000000000"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } +} |