summaryrefslogtreecommitdiffstats
path: root/common/src/test/java/org/openecomp/mso/properties/MsoJavaPropertiesESTest.java
blob: d64f63fb2c7514a4c8ace83c581d6051a2542911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/*
 * This file was automatically generated by EvoSuite
 * Thu Nov 10 08:35:35 GMT 2016
 */

package org.openecomp.mso.properties;

import static org.evosuite.runtime.EvoAssertions.verifyException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.FileNotFoundException;

import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.PrivateAccess;
import org.evosuite.runtime.testdata.FileSystemHandling;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.openecomp.mso.logger.MsoLogger;

@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
public class MsoJavaPropertiesESTest extends MsoJavaPropertiesESTestscaffolding {

  @Test(timeout = 4000)
  public void test00()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.setProperty("", "J6");
      msoJavaProperties0.hashCode();
  }

  @Test(timeout = 4000)
  public void test02()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      String string0 = msoJavaProperties0.getProperty("IK#uRP]", (String) null);
      assertNull(string0);
  }

  @Test(timeout = 4000)
  public void test03()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      String string0 = msoJavaProperties0.getProperty("", "");
      assertNotNull(string0);
      assertEquals("", string0);
  }

  @Test(timeout = 4000)
  public void test04()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      int int0 = msoJavaProperties0.getIntProperty("RA_VNF_NOT_EXIST", (-1417));
      assertEquals((-1417), int0);
  }

  @Test(timeout = 4000)
  public void test05()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      String string0 = msoJavaProperties0.getEncryptedProperty("", "", "");
      assertEquals("", string0);
      assertNotNull(string0);
  }

  @Test(timeout = 4000)
  public void test06()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.automaticRefreshInMinutes = 1821;
      MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
      assertNotSame(msoJavaProperties1, msoJavaProperties0);
      assertEquals(1821, msoJavaProperties1.getAutomaticRefreshInMinutes());
  }

  @Test(timeout = 4000)
  public void test07()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.automaticRefreshInMinutes = (-78);
      MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
      assertNotSame(msoJavaProperties1, msoJavaProperties0);
      assertEquals(-78, msoJavaProperties1.getAutomaticRefreshInMinutes());
  }

  @Test(timeout = 4000)
  public void test08()  throws Throwable  {
      FileSystemHandling fileSystemHandling0 = new FileSystemHandling();
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      PrivateAccess.setVariable((Class<MsoJavaProperties>) MsoJavaProperties.class, msoJavaProperties0, "msoProperties", (Object) null);
      msoJavaProperties0.hashCode();
      msoJavaProperties0.hashCode();
      // Undeclared exception!
      try { 
        msoJavaProperties0.size();
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.openecomp.mso.properties.MsoJavaProperties", e);
      }
  }

  @Test(timeout = 4000)
  public void test09()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      // Undeclared exception!
      try { 
        msoJavaProperties0.setProperty((String) null, "+UaYo-~&{QxdaN(c");
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
      }
  }

  @Test(timeout = 4000)
  public void test11()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
      msoJavaProperties1.propertiesFileName = "";
      try { 
        msoJavaProperties1.reloadPropertiesFile();
        fail("Expecting exception: FileNotFoundException");
      
      } catch(FileNotFoundException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
      }
  }

  /**
   * TODO: fails when run using maven, but succeeds when run using eclipse
   */
  @Ignore
  @Test(timeout = 4000)
  public void test12()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      // Undeclared exception!
      try { 
        msoJavaProperties0.loadPropertiesFile((String) null);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
      }
  }

  @Test(timeout = 4000)
  public void test13()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      try { 
        msoJavaProperties0.loadPropertiesFile("");
        fail("Expecting exception: FileNotFoundException");
      
      } catch(FileNotFoundException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
      }
  }

  @Test(timeout = 4000)
  public void test14()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      // Undeclared exception!
      try { 
        msoJavaProperties0.getIntProperty((String) null, 0);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
      }
  }

  @Test(timeout = 4000)
  public void test15()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.setProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", "");
      // Undeclared exception!
      try { 
        msoJavaProperties0.getEncryptedProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", "", "k$&Fq}");
        fail("Expecting exception: NumberFormatException");
      
      } catch(NumberFormatException e) {
         //
         // For input string: \"k$\"
         //
         verifyException("java.lang.NumberFormatException", e);
      }
  }

  @Test(timeout = 4000)
  public void test16()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
      msoJavaProperties1.clone();
      msoJavaProperties0.hashCode();
      MsoJavaProperties msoJavaProperties2 = msoJavaProperties1.clone();
      PrivateAccess.setVariable((Class<MsoJavaProperties>) MsoJavaProperties.class, msoJavaProperties0, "msoProperties", (Object) null);
      msoJavaProperties1.equals(msoJavaProperties2);
      MsoLogger msoLogger0 = AbstractMsoProperties.LOGGER;
      // Undeclared exception!
      try { 
        msoJavaProperties0.clone();
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("java.util.Hashtable", e);
      }
  }

  @Test(timeout = 4000)
  public void test18()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      int int0 = msoJavaProperties0.getIntProperty("", 0);
      assertEquals(0, int0);
  }

  @Test(timeout = 4000)
  public void test19()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.setProperty("-6;qct1", "");
      String string0 = msoJavaProperties0.toString();
      assertEquals("Config file null(Timer:0mins):\n-6;qct1=\n\n\n", string0);
  }

  @Test(timeout = 4000)
  public void test20()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      boolean boolean0 = msoJavaProperties0.equals("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION");
      assertFalse(boolean0);
  }

  @Test(timeout = 4000)
  public void test21()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      boolean boolean0 = msoJavaProperties0.equals((Object) null);
      assertFalse(boolean0);
  }

  @Test(timeout = 4000)
  public void test22()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      boolean boolean0 = msoJavaProperties0.equals(msoJavaProperties0);
      assertTrue(boolean0);
  }

  @Test(timeout = 4000)
  public void test24()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.setProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", "");
      // Undeclared exception!
      try { 
        msoJavaProperties0.getEncryptedProperty("APIH_READ_VNFOUTPUT_CLOB_EXCEPTION", ".", "");
        fail("Expecting exception: IllegalArgumentException");
      
      } catch(IllegalArgumentException e) {
         //
         // Empty key
         //
         verifyException("javax.crypto.spec.SecretKeySpec", e);
      }
  }

  @Test(timeout = 4000)
  public void test25()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      String string0 = msoJavaProperties0.getEncryptedProperty("YhmJSc|~L0$,?/oh", (String) null, "YhmJSc|~L0$,?/oh");
      assertNull(string0);
  }

  @Test(timeout = 4000)
  public void test26()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.setProperty("M;WrYY%E,;sa&4F", "M;WrYY%E,;sa&4F");
      boolean boolean0 = msoJavaProperties0.getBooleanProperty("M;WrYY%E,;sa&4F", false);
      assertFalse(boolean0);
  }

  @Test(timeout = 4000)
  public void test27()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      boolean boolean0 = msoJavaProperties0.getBooleanProperty("", true);
      assertTrue(boolean0);
  }

  @Test(timeout = 4000)
  public void test28()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.setProperty("M;WrYY%E,;sa&4F", "M;WrYY%E,;sa&4F");
      int int0 = msoJavaProperties0.getIntProperty("M;WrYY%E,;sa&4F", 0);
      assertEquals(0, int0);
  }

  @Test(timeout = 4000)
  public void test29()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      msoJavaProperties0.setProperty("", "J6");
      String string0 = msoJavaProperties0.getProperty("", "mso.properties.reload.time.minutes");
      assertNotNull(string0);
      assertEquals("J6", string0);
  }
  /**
   * TODO: fails when run using maven, but succeeds when run using eclipse
   */
  @Ignore
  @Test(timeout = 4000)
  public void test30()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      // Undeclared exception!
      try { 
        msoJavaProperties0.reloadPropertiesFile();
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
      }
  }

  @Test(timeout = 4000)
  public void test31()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      MsoJavaProperties msoJavaProperties1 = msoJavaProperties0.clone();
      assertTrue(msoJavaProperties1.equals((Object)msoJavaProperties0));
      
      msoJavaProperties0.setProperty("", "");
      boolean boolean0 = msoJavaProperties0.equals(msoJavaProperties1);
      assertFalse(boolean0);
      assertFalse(msoJavaProperties1.equals((Object)msoJavaProperties0));
  }

  @Test(timeout = 4000)
  public void test32()  throws Throwable  {
      MsoJavaProperties msoJavaProperties0 = new MsoJavaProperties();
      int int0 = msoJavaProperties0.size();
      assertEquals(0, int0);
  }
}