Initial OpenECOMP MSO commit
[so.git] / common / src / test / java / org / openecomp / mso / utils / CryptoUtilsESTest.java
1 /*
2  * This file was automatically generated by EvoSuite
3  * Mon Nov 14 09:07:10 GMT 2016
4  */
5
6 package org.openecomp.mso.utils;
7
8 import org.junit.Test;
9 import static org.junit.Assert.*;
10 import static org.evosuite.runtime.EvoAssertions.*;
11
12 import javax.crypto.BadPaddingException;
13 import javax.crypto.IllegalBlockSizeException;
14 import org.evosuite.runtime.EvoRunner;
15 import org.evosuite.runtime.EvoRunnerParameters;
16 import org.junit.runner.RunWith;
17
18 @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
19 public class CryptoUtilsESTest extends CryptoUtilsESTestscaffolding {
20
21   @Test(timeout = 4000)
22   public void test00()  throws Throwable  {
23       CryptoUtils.decrypt("E08682BE5F2B18A6E8437A15B110D418E08682BE5F2B18A6E8437A15B110D4180143DB63EE66B0CDFF9F69917680151E", "00000000000000000000000000000000");
24   }
25
26   @Test(timeout = 4000)
27   public void test01()  throws Throwable  {
28       byte[] byteArray0 = new byte[0];
29       CryptoUtils.byteArrayToHexString(byteArray0);
30   }
31
32   @Test(timeout = 4000)
33   public void test02()  throws Throwable  {
34       // Undeclared exception!
35       try { 
36         CryptoUtils.encrypt("AES", "w^p&|^Cvs@K.@@");
37         fail("Expecting exception: NumberFormatException");
38       
39       } catch(NumberFormatException e) {
40          //
41          // For input string: \"w^\"
42          //
43          verifyException("java.lang.NumberFormatException", e);
44       }
45   }
46
47   @Test(timeout = 4000)
48   public void test03()  throws Throwable  {
49       // Undeclared exception!
50       try { 
51         CryptoUtils.encrypt((String) null, "B2000000000000000000000000000000");
52         fail("Expecting exception: NullPointerException");
53       
54       } catch(NullPointerException e) {
55          //
56          // no message in exception (getMessage() returned null)
57          //
58          verifyException("org.openecomp.mso.utils.CryptoUtils", e);
59       }
60   }
61
62   @Test(timeout = 4000)
63   public void test04()  throws Throwable  {
64       try { 
65         CryptoUtils.decrypt("B20000000000000000000000000000000000000000000000", "B20000000000000000000000000000000000000000000000");
66         fail("Expecting exception: IllegalBlockSizeException");
67       
68       } catch(IllegalBlockSizeException e) {
69       }
70   }
71
72   @Test(timeout = 4000)
73   public void test05()  throws Throwable  {
74       try { 
75         CryptoUtils.decrypt("0000C200000000000000000000000000", "0000C200000000000000000000000000");
76         fail("Expecting exception: BadPaddingException");
77       
78       } catch(BadPaddingException e) {
79       }
80   }
81
82   @Test(timeout = 4000)
83   public void test06()  throws Throwable  {
84       // Undeclared exception!
85       try { 
86         CryptoUtils.decrypt("s.", "s.");
87         fail("Expecting exception: NumberFormatException");
88       
89       } catch(NumberFormatException e) {
90          //
91          // For input string: \"s.\"
92          //
93          verifyException("java.lang.NumberFormatException", e);
94       }
95   }
96
97   @Test(timeout = 4000)
98   public void test07()  throws Throwable  {
99       // Undeclared exception!
100       try { 
101         CryptoUtils.decrypt("", "");
102         fail("Expecting exception: IllegalArgumentException");
103       
104       } catch(IllegalArgumentException e) {
105          //
106          // Empty key
107          //
108          verifyException("javax.crypto.spec.SecretKeySpec", e);
109       }
110   }
111
112   @Test(timeout = 4000)
113   public void test08()  throws Throwable  {
114       // Undeclared exception!
115       try { 
116         CryptoUtils.byteArrayToHexString((byte[]) null);
117         fail("Expecting exception: NullPointerException");
118       
119       } catch(NullPointerException e) {
120          //
121          // no message in exception (getMessage() returned null)
122          //
123          verifyException("org.openecomp.mso.utils.CryptoUtils", e);
124       }
125   }
126
127   @Test(timeout = 4000)
128   public void test09()  throws Throwable  {
129       byte[] byteArray0 = new byte[16];
130       byteArray0[0] = (byte) (-78);
131       String string0 = CryptoUtils.byteArrayToHexString(byteArray0);
132       assertEquals("B2000000000000000000000000000000", string0);
133   }
134
135   @Test(timeout = 4000)
136   public void test10()  throws Throwable  {
137       String string0 = CryptoUtils.encrypt("00000000000000000000000000000000", "00000000000000000000000000000000");
138       assertEquals("E08682BE5F2B18A6E8437A15B110D418E08682BE5F2B18A6E8437A15B110D4180143DB63EE66B0CDFF9F69917680151E", string0);
139   }
140
141   @Test(timeout = 4000)
142   public void test11()  throws Throwable  {
143       // Undeclared exception!
144       try { 
145         CryptoUtils.encrypt("", "");
146         fail("Expecting exception: IllegalArgumentException");
147       
148       } catch(IllegalArgumentException e) {
149          //
150          // Empty key
151          //
152          verifyException("javax.crypto.spec.SecretKeySpec", e);
153       }
154   }
155
156   @Test(timeout = 4000)
157   public void test12()  throws Throwable  {
158       CryptoUtils cryptoUtils0 = new CryptoUtils();
159   }
160
161   @Test(timeout = 4000)
162   public void test13()  throws Throwable  {
163       // Undeclared exception!
164       try { 
165         CryptoUtils.decrypt((String) null, "00000000000000000000000000000000");
166         fail("Expecting exception: NullPointerException");
167       
168       } catch(NullPointerException e) {
169          //
170          // no message in exception (getMessage() returned null)
171          //
172          verifyException("org.openecomp.mso.utils.CryptoUtils", e);
173       }
174   }
175 }