2 * This file was automatically generated by EvoSuite
3 * Fri Nov 25 13:17:51 GMT 2016
6 package org.openecomp.mso.asdc.util;
9 import static org.junit.Assert.*;
10 import static org.evosuite.shaded.org.mockito.Mockito.*;
11 import static org.evosuite.runtime.MockitoExtension.*;
12 import static org.evosuite.runtime.EvoAssertions.*;
14 import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
15 import java.util.HashMap;
16 import java.util.Iterator;
17 import java.util.LinkedHashSet;
18 import java.util.List;
21 import org.evosuite.runtime.EvoRunner;
22 import org.evosuite.runtime.EvoRunnerParameters;
23 import org.evosuite.runtime.PrivateAccess;
24 import org.evosuite.runtime.ViolatedAssumptionAnswer;
25 import org.junit.runner.RunWith;
26 import org.yaml.snakeyaml.Yaml;
28 @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
29 public class YamlEditorESTest extends YamlEditorESTestscaffolding {
32 public void test00() throws Throwable {
33 YamlEditor yamlEditor0 = new YamlEditor();
34 boolean boolean0 = yamlEditor0.isParentTemplate("file:///");
39 public void test01() throws Throwable {
40 YamlEditor yamlEditor0 = new YamlEditor();
41 HashMap<String, Object> hashMap0 = new HashMap<String, Object>();
42 Yaml yaml0 = mock(Yaml.class, new ViolatedAssumptionAnswer());
43 doReturn((String) null, (String) null).when(yaml0).dump(any());
44 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yaml", (Object) yaml0);
45 yamlEditor0.encode((Map<String, Object>) hashMap0);
46 Map<String, Object> map0 = (Map<String, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
47 doReturn((Object) null).when(map0).get(any());
48 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
49 yamlEditor0.toString();
50 // Undeclared exception!
52 yamlEditor0.getYamlResourceTypeList();
53 fail("Expecting exception: NullPointerException");
55 } catch(NullPointerException e) {
57 // no message in exception (getMessage() returned null)
59 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
64 public void test02() throws Throwable {
65 YamlEditor yamlEditor0 = new YamlEditor();
66 HashMap<Object, String> hashMap0 = new HashMap<Object, String>();
67 Yaml yaml0 = mock(Yaml.class, new ViolatedAssumptionAnswer());
68 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yaml", (Object) yaml0);
69 Object object0 = new Object();
70 Map<Integer, Object> map0 = (Map<Integer, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
71 doReturn(hashMap0, object0).when(map0).get(any());
72 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
73 yamlEditor0.getParameterList();
74 // Undeclared exception!
76 yamlEditor0.getYamlResourceTypeList();
77 fail("Expecting exception: ClassCastException");
79 } catch(ClassCastException e) {
81 // java.lang.Object cannot be cast to java.util.Map
83 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
88 public void test03() throws Throwable {
89 YamlEditor yamlEditor0 = new YamlEditor();
90 // Undeclared exception!
92 yamlEditor0.getYamlNestedFileResourceTypeList();
93 fail("Expecting exception: NullPointerException");
95 } catch(NullPointerException e) {
97 // no message in exception (getMessage() returned null)
99 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
103 @Test(timeout = 4000)
104 public void test04() throws Throwable {
105 YamlEditor yamlEditor0 = new YamlEditor();
106 HashMap<Object, String> hashMap0 = new HashMap<Object, String>();
107 Yaml yaml0 = mock(Yaml.class, new ViolatedAssumptionAnswer());
108 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yaml", (Object) yaml0);
109 Map<Integer, Object> map0 = (Map<Integer, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
110 doReturn(hashMap0, (Object) null).when(map0).get(any());
111 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
112 yamlEditor0.getYamlNestedFileResourceTypeList();
113 // Undeclared exception!
115 yamlEditor0.getParameterList();
116 fail("Expecting exception: NullPointerException");
118 } catch(NullPointerException e) {
120 // no message in exception (getMessage() returned null)
122 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
126 @Test(timeout = 4000)
127 public void test05() throws Throwable {
128 YamlEditor yamlEditor0 = new YamlEditor();
129 HashMap<String, Object> hashMap0 = new HashMap<String, Object>();
130 Set<Map.Entry<String, Object>> set0 = (Set<Map.Entry<String, Object>>)hashMap0.entrySet();
131 hashMap0.put("null\n", set0);
132 // Undeclared exception!
134 yamlEditor0.encode((Map<String, Object>) hashMap0);
135 fail("Expecting exception: StackOverflowError");
137 } catch(StackOverflowError e) {
139 // no message in exception (getMessage() returned null)
144 @Test(timeout = 4000)
145 public void test06() throws Throwable {
146 YamlEditor yamlEditor0 = new YamlEditor();
147 Set<Map.Entry<String, Object>> set0 = (Set<Map.Entry<String, Object>>) mock(Set.class, new ViolatedAssumptionAnswer());
148 doReturn((Iterator) null).when(set0).iterator();
149 Map<String, Object> map0 = (Map<String, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
150 doReturn(set0).when(map0).entrySet();
151 doReturn(2655).when(map0).size();
152 // Undeclared exception!
154 yamlEditor0.encode(map0);
155 fail("Expecting exception: NullPointerException");
157 } catch(NullPointerException e) {
159 // no message in exception (getMessage() returned null)
161 verifyException("org.yaml.snakeyaml.representer.BaseRepresenter", e);
165 @Test(timeout = 4000)
166 public void test07() throws Throwable {
167 YamlEditor yamlEditor0 = new YamlEditor();
168 Map<String, Object> map0 = (Map<String, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
169 doReturn((-300)).when(map0).size();
170 // Undeclared exception!
172 yamlEditor0.encode(map0);
173 fail("Expecting exception: IllegalArgumentException");
175 } catch(IllegalArgumentException e) {
177 // Illegal Capacity: -300
179 verifyException("java.util.ArrayList", e);
183 @Test(timeout = 4000)
184 public void test08() throws Throwable {
185 byte[] byteArray0 = new byte[0];
186 YamlEditor yamlEditor0 = new YamlEditor(byteArray0);
187 Map<HeatTemplateParam, String> map0 = (Map<HeatTemplateParam, String>) mock(Map.class, new ViolatedAssumptionAnswer());
188 doReturn("").when(map0).get(any());
189 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
190 LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
191 // Undeclared exception!
193 yamlEditor0.addParameterList(linkedHashSet0);
194 fail("Expecting exception: ClassCastException");
196 } catch(ClassCastException e) {
198 // java.lang.String cannot be cast to java.util.Map
200 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
204 @Test(timeout = 4000)
205 public void test09() throws Throwable {
206 byte[] byteArray0 = new byte[1];
207 YamlEditor yamlEditor0 = null;
209 yamlEditor0 = new YamlEditor(byteArray0);
210 fail("Expecting exception: RuntimeException");
212 } catch(RuntimeException e) {
214 // special characters are not allowed
216 verifyException("org.yaml.snakeyaml.reader.StreamReader", e);
220 @Test(timeout = 4000)
221 public void test10() throws Throwable {
222 byte[] byteArray0 = new byte[1];
223 byteArray0[0] = (byte)37;
224 YamlEditor yamlEditor0 = null;
226 yamlEditor0 = new YamlEditor(byteArray0);
227 fail("Expecting exception: RuntimeException");
229 } catch(RuntimeException e) {
231 // while scanning a directive
232 // in 'reader', line 1, column 1:
235 // expected alphabetic or numeric character, but found \u0000(0)
236 // in 'reader', line 1, column 2:
240 verifyException("org.yaml.snakeyaml.scanner.ScannerImpl", e);
244 @Test(timeout = 4000)
245 public void test11() throws Throwable {
246 byte[] byteArray0 = new byte[2];
247 byteArray0[1] = (byte) (-80);
248 YamlEditor yamlEditor0 = null;
250 yamlEditor0 = new YamlEditor(byteArray0);
251 fail("Expecting exception: RuntimeException");
253 } catch(RuntimeException e) {
255 // java.nio.charset.MalformedInputException: Input length = 1
257 verifyException("org.yaml.snakeyaml.reader.StreamReader", e);
261 @Test(timeout = 4000)
262 public void test13() throws Throwable {
263 byte[] byteArray0 = new byte[1];
264 byteArray0[0] = (byte)110;
265 YamlEditor yamlEditor0 = null;
267 yamlEditor0 = new YamlEditor(byteArray0);
268 fail("Expecting exception: ClassCastException");
270 } catch(ClassCastException e) {
272 // java.lang.String cannot be cast to java.util.Map
274 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
278 @Test(timeout = 4000)
279 public void test14() throws Throwable {
280 YamlEditor yamlEditor0 = new YamlEditor();
281 String string0 = yamlEditor0.encode();
282 assertEquals("null\n", string0);
285 @Test(timeout = 4000)
286 public void test15() throws Throwable {
287 YamlEditor yamlEditor0 = new YamlEditor();
288 HashMap<Object, String> hashMap0 = new HashMap<Object, String>();
289 Map<Integer, Object> map0 = (Map<Integer, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
290 doReturn(hashMap0).when(map0).get(any());
291 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
292 Set<HeatTemplateParam> set0 = (Set<HeatTemplateParam>) mock(Set.class, new ViolatedAssumptionAnswer());
293 doReturn((Iterator) null).when(set0).iterator();
294 // Undeclared exception!
296 yamlEditor0.addParameterList(set0);
297 fail("Expecting exception: NullPointerException");
299 } catch(NullPointerException e) {
301 // no message in exception (getMessage() returned null)
303 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
307 @Test(timeout = 4000)
308 public void test16() throws Throwable {
309 byte[] byteArray0 = new byte[0];
310 YamlEditor yamlEditor0 = new YamlEditor(byteArray0);
311 HashMap<HeatTemplateParam, String> hashMap0 = new HashMap<HeatTemplateParam, String>();
312 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) hashMap0);
313 LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
314 HeatTemplateParam heatTemplateParam0 = mock(HeatTemplateParam.class, new ViolatedAssumptionAnswer());
315 doReturn(">!=_`7`2d(").when(heatTemplateParam0).getParamName();
316 doReturn(">!=_`7`2d(").when(heatTemplateParam0).getParamType();
317 linkedHashSet0.add(heatTemplateParam0);
318 yamlEditor0.addParameterList(linkedHashSet0);
319 Set<HeatTemplateParam> set0 = yamlEditor0.getParameterList();
320 assertFalse(set0.isEmpty());
323 @Test(timeout = 4000)
324 public void test17() throws Throwable {
325 YamlEditor yamlEditor0 = new YamlEditor();
326 HashMap<Object, String> hashMap0 = new HashMap<Object, String>();
327 Map<Integer, Object> map0 = (Map<Integer, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
328 doReturn(hashMap0).when(map0).get(any());
329 hashMap0.put(yamlEditor0, "V28");
330 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
331 // Undeclared exception!
333 yamlEditor0.getParameterList();
334 fail("Expecting exception: ClassCastException");
336 } catch(ClassCastException e) {
338 // java.lang.String cannot be cast to java.util.Map
340 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
344 @Test(timeout = 4000)
345 public void test18() throws Throwable {
346 YamlEditor yamlEditor0 = new YamlEditor();
347 HashMap<Object, String> hashMap0 = new HashMap<Object, String>();
348 Map<Integer, Object> map0 = (Map<Integer, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
349 doReturn(hashMap0).when(map0).get(any());
350 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
351 List<String> list0 = yamlEditor0.getYamlResourceTypeList();
352 assertEquals(0, list0.size());
355 @Test(timeout = 4000)
356 public void test19() throws Throwable {
357 YamlEditor yamlEditor0 = new YamlEditor();
358 // Undeclared exception!
360 yamlEditor0.isParentTemplate((String) null);
361 fail("Expecting exception: NullPointerException");
363 } catch(NullPointerException e) {
365 // no message in exception (getMessage() returned null)
367 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
371 @Test(timeout = 4000)
372 public void test20() throws Throwable {
373 YamlEditor yamlEditor0 = new YamlEditor();
374 yamlEditor0.verifyTemplate();
375 yamlEditor0.isParentTemplate("\"");
376 Map<String, Object> map0 = (Map<String, Object>) mock(Map.class, new ViolatedAssumptionAnswer());
377 doReturn(yamlEditor0).when(map0).get(any());
378 PrivateAccess.setVariable((Class<YamlEditor>) YamlEditor.class, yamlEditor0, "yml", (Object) map0);
379 // Undeclared exception!
381 yamlEditor0.getYamlNestedFileResourceTypeList();
382 fail("Expecting exception: ClassCastException");
384 } catch(ClassCastException e) {
386 // org.openecomp.mso.asdc.util.YamlEditor cannot be cast to java.util.Map
388 verifyException("org.openecomp.mso.asdc.util.YamlEditor", e);
392 @Test(timeout = 4000)
393 public void test21() throws Throwable {
394 YamlEditor yamlEditor0 = new YamlEditor();
395 HashMap<String, Object> hashMap0 = new HashMap<String, Object>();
396 String string0 = yamlEditor0.encode((Map<String, Object>) hashMap0);
397 assertEquals("{}\n", string0);
400 @Test(timeout = 4000)
401 public void test22() throws Throwable {
402 YamlEditor yamlEditor0 = null;
404 yamlEditor0 = new YamlEditor((byte[]) null);
405 fail("Expecting exception: NullPointerException");
407 } catch(NullPointerException e) {
409 // no message in exception (getMessage() returned null)
414 @Test(timeout = 4000)
415 public void test23() throws Throwable {
416 YamlEditor yamlEditor0 = new YamlEditor();
417 String string0 = yamlEditor0.toString();
418 assertEquals("null\n", string0);