d64f63fb2c7514a4c8ace83c581d6051a2542911
[so.git] / common / src / test / java / org / openecomp / mso / properties / MsoJavaPropertiesESTest.java
1 /*
2  * This file was automatically generated by EvoSuite
3  * Thu Nov 10 08:35:35 GMT 2016
4  */
5
6 package org.openecomp.mso.properties;
7
8 import static org.evosuite.runtime.EvoAssertions.verifyException;
9 import static org.junit.Assert.assertEquals;
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertNotSame;
13 import static org.junit.Assert.assertNull;
14 import static org.junit.Assert.assertTrue;
15 import static org.junit.Assert.fail;
16
17 import java.io.FileNotFoundException;
18
19 import org.evosuite.runtime.EvoRunner;
20 import org.evosuite.runtime.EvoRunnerParameters;
21 import org.evosuite.runtime.PrivateAccess;
22 import org.evosuite.runtime.testdata.FileSystemHandling;
23 import org.junit.Ignore;
24 import org.junit.Test;
25 import org.junit.runner.RunWith;
26
27 import org.openecomp.mso.logger.MsoLogger;
28
29 @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
30 public class MsoJavaPropertiesESTest extends MsoJavaPropertiesESTestscaffolding {
31
32   @Test(timeout = 4000)
33   public void test00()  throws Throwable  {
34       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
35       msoJavaProperties0.setProperty("", "J6");
36       msoJavaProperties0.hashCode();
37   }
38
39   @Test(timeout = 4000)
40   public void test02()  throws Throwable  {
41       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
42       String string0 = msoJavaProperties0.getProperty("IK#uRP]", (String) null);
43       assertNull(string0);
44   }
45
46   @Test(timeout = 4000)
47   public void test03()  throws Throwable  {
48       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
49       String string0 = msoJavaProperties0.getProperty("", "");
50       assertNotNull(string0);
51       assertEquals("", string0);
52   }
53
54   @Test(timeout = 4000)
55   public void test04()  throws Throwable  {
56       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
57       int int0 = msoJavaProperties0.getIntProperty("RA_VNF_NOT_EXIST", (-1417));
58       assertEquals((-1417), int0);
59   }
60
61   @Test(timeout = 4000)
62   public void test05()  throws Throwable  {
63       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
64       String string0 = msoJavaProperties0.getEncryptedProperty("", "", "");
65       assertEquals("", string0);
66       assertNotNull(string0);
67   }
68
69   @Test(timeout = 4000)
70   public void test06()  throws Throwable  {
71       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
72       msoJavaProperties0.automaticRefreshInMinutes = 1821;
73       MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
74       assertNotSame(msoJavaProperties1, msoJavaProperties0);
75       assertEquals(1821, msoJavaProperties1.getAutomaticRefreshInMinutes());
76   }
77
78   @Test(timeout = 4000)
79   public void test07()  throws Throwable  {
80       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
81       msoJavaProperties0.automaticRefreshInMinutes = (-78);
82       MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
83       assertNotSame(msoJavaProperties1, msoJavaProperties0);
84       assertEquals(-78, msoJavaProperties1.getAutomaticRefreshInMinutes());
85   }
86
87   @Test(timeout = 4000)
88   public void test08()  throws Throwable  {
89       FileSystemHandling fileSystemHandling0 = new FileSystemHandling();
90       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
91       PrivateAccess.setVariable((Class<MsoJavaProperties>) MsoJavaProperties.class, msoJavaProperties0, "msoProperties", (Object) null);
92       msoJavaProperties0.hashCode();
93       msoJavaProperties0.hashCode();
94       // Undeclared exception!
95       try { 
96         msoJavaProperties0.size();
97         fail("Expecting exception: NullPointerException");
98       
99       } catch(NullPointerException e) {
100          //
101          // no message in exception (getMessage() returned null)
102          //
103          verifyException("org.openecomp.mso.properties.MsoJavaProperties", e);
104       }
105   }
106
107   @Test(timeout = 4000)
108   public void test09()  throws Throwable  {
109       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
110       // Undeclared exception!
111       try { 
112         msoJavaProperties0.setProperty((String) null, "+UaYo-~&{QxdaN(c");
113         fail("Expecting exception: NullPointerException");
114       
115       } catch(NullPointerException e) {
116          //
117          // no message in exception (getMessage() returned null)
118          //
119       }
120   }
121
122   @Test(timeout = 4000)
123   public void test11()  throws Throwable  {
124       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
125       MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
126       msoJavaProperties1.propertiesFileName = "";
127       try { 
128         msoJavaProperties1.reloadPropertiesFile();
129         fail("Expecting exception: FileNotFoundException");
130       
131       } catch(FileNotFoundException e) {
132          //
133          // no message in exception (getMessage() returned null)
134          //
135          verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
136       }
137   }
138
139   /**
140    * TODO: fails when run using maven, but succeeds when run using eclipse
141    */
142   @Ignore
143   @Test(timeout = 4000)
144   public void test12()  throws Throwable  {
145       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
146       // Undeclared exception!
147       try { 
148         msoJavaProperties0.loadPropertiesFile((String) null);
149         fail("Expecting exception: NullPointerException");
150       
151       } catch(NullPointerException e) {
152          //
153          // no message in exception (getMessage() returned null)
154          //
155          verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
156       }
157   }
158
159   @Test(timeout = 4000)
160   public void test13()  throws Throwable  {
161       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
162       try { 
163         msoJavaProperties0.loadPropertiesFile("");
164         fail("Expecting exception: FileNotFoundException");
165       
166       } catch(FileNotFoundException e) {
167          //
168          // no message in exception (getMessage() returned null)
169          //
170          verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
171       }
172   }
173
174   @Test(timeout = 4000)
175   public void test14()  throws Throwable  {
176       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
177       // Undeclared exception!
178       try { 
179         msoJavaProperties0.getIntProperty((String) null, 0);
180         fail("Expecting exception: NullPointerException");
181       
182       } catch(NullPointerException e) {
183          //
184          // no message in exception (getMessage() returned null)
185          //
186       }
187   }
188
189   @Test(timeout = 4000)
190   public void test15()  throws Throwable  {
191       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
192       msoJavaProperties0.setProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", "");
193       // Undeclared exception!
194       try { 
195         msoJavaProperties0.getEncryptedProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", "", "k$&Fq}");
196         fail("Expecting exception: NumberFormatException");
197       
198       } catch(NumberFormatException e) {
199          //
200          // For input string: \"k$\"
201          //
202          verifyException("java.lang.NumberFormatException", e);
203       }
204   }
205
206   @Test(timeout = 4000)
207   public void test16()  throws Throwable  {
208       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
209       MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
210       msoJavaProperties1.clone();
211       msoJavaProperties0.hashCode();
212       MsoJavaProperties msoJavaProperties2 = msoJavaProperties1.clone();
213       PrivateAccess.setVariable((Class<MsoJavaProperties>) MsoJavaProperties.class, msoJavaProperties0, "msoProperties", (Object) null);
214       msoJavaProperties1.equals(msoJavaProperties2);
215       MsoLogger msoLogger0 = AbstractMsoProperties.LOGGER;
216       // Undeclared exception!
217       try { 
218         msoJavaProperties0.clone();
219         fail("Expecting exception: NullPointerException");
220       
221       } catch(NullPointerException e) {
222          //
223          // no message in exception (getMessage() returned null)
224          //
225          verifyException("java.util.Hashtable", e);
226       }
227   }
228
229   @Test(timeout = 4000)
230   public void test18()  throws Throwable  {
231       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
232       int int0 = msoJavaProperties0.getIntProperty("", 0);
233       assertEquals(0, int0);
234   }
235
236   @Test(timeout = 4000)
237   public void test19()  throws Throwable  {
238       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
239       msoJavaProperties0.setProperty("-6;qct1", "");
240       String string0 = msoJavaProperties0.toString();
241       assertEquals("Config file null(Timer:0mins):\n-6;qct1=\n\n\n", string0);
242   }
243
244   @Test(timeout = 4000)
245   public void test20()  throws Throwable  {
246       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
247       boolean boolean0 = msoJavaProperties0.equals("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION");
248       assertFalse(boolean0);
249   }
250
251   @Test(timeout = 4000)
252   public void test21()  throws Throwable  {
253       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
254       boolean boolean0 = msoJavaProperties0.equals((Object) null);
255       assertFalse(boolean0);
256   }
257
258   @Test(timeout = 4000)
259   public void test22()  throws Throwable  {
260       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
261       boolean boolean0 = msoJavaProperties0.equals(msoJavaProperties0);
262       assertTrue(boolean0);
263   }
264
265   @Test(timeout = 4000)
266   public void test24()  throws Throwable  {
267       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
268       msoJavaProperties0.setProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", "");
269       // Undeclared exception!
270       try { 
271         msoJavaProperties0.getEncryptedProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", ".", "");
272         fail("Expecting exception: IllegalArgumentException");
273       
274       } catch(IllegalArgumentException e) {
275          //
276          // Empty key
277          //
278          verifyException("javax.crypto.spec.SecretKeySpec", e);
279       }
280   }
281
282   @Test(timeout = 4000)
283   public void test25()  throws Throwable  {
284       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
285       String string0 = msoJavaProperties0.getEncryptedProperty("YhmJSc|~L0$\7f,?/oh", (String) null, "YhmJSc|~L0$\7f,?/oh");
286       assertNull(string0);
287   }
288
289   @Test(timeout = 4000)
290   public void test26()  throws Throwable  {
291       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
292       msoJavaProperties0.setProperty("M;WrYY%E,;sa&4F", "M;WrYY%E,;sa&4F");
293       boolean boolean0 = msoJavaProperties0.getBooleanProperty("M;WrYY%E,;sa&4F", false);
294       assertFalse(boolean0);
295   }
296
297   @Test(timeout = 4000)
298   public void test27()  throws Throwable  {
299       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
300       boolean boolean0 = msoJavaProperties0.getBooleanProperty("", true);
301       assertTrue(boolean0);
302   }
303
304   @Test(timeout = 4000)
305   public void test28()  throws Throwable  {
306       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
307       msoJavaProperties0.setProperty("M;WrYY%E,;sa&4F", "M;WrYY%E,;sa&4F");
308       int int0 = msoJavaProperties0.getIntProperty("M;WrYY%E,;sa&4F", 0);
309       assertEquals(0, int0);
310   }
311
312   @Test(timeout = 4000)
313   public void test29()  throws Throwable  {
314       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
315       msoJavaProperties0.setProperty("", "J6");
316       String string0 = msoJavaProperties0.getProperty("", "mso.properties.reload.time.minutes");
317       assertNotNull(string0);
318       assertEquals("J6", string0);
319   }
320   /**
321    * TODO: fails when run using maven, but succeeds when run using eclipse
322    */
323   @Ignore
324   @Test(timeout = 4000)
325   public void test30()  throws Throwable  {
326       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
327       // Undeclared exception!
328       try { 
329         msoJavaProperties0.reloadPropertiesFile();
330         fail("Expecting exception: NullPointerException");
331       
332       } catch(NullPointerException e) {
333          //
334          // no message in exception (getMessage() returned null)
335          //
336          verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
337       }
338   }
339
340   @Test(timeout = 4000)
341   public void test31()  throws Throwable  {
342       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
343       MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
344       assertTrue(msoJavaProperties1.equals((Object)msoJavaProperties0));
345       
346       msoJavaProperties0.setProperty("", "");
347       boolean boolean0 = msoJavaProperties0.equals(msoJavaProperties1);
348       assertFalse(boolean0);
349       assertFalse(msoJavaProperties1.equals((Object)msoJavaProperties0));
350   }
351
352   @Test(timeout = 4000)
353   public void test32()  throws Throwable  {
354       MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
355       int int0 = msoJavaProperties0.size();
356       assertEquals(0, int0);
357   }
358 }