2 * This file was automatically generated by EvoSuite
3 * Mon Mar 13 16:09:00 GMT 2017
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.*;
13 import java.util.Iterator;
14 import java.util.LinkedList;
15 import java.util.List;
17 import java.util.function.UnaryOperator;
18 import org.evosuite.runtime.EvoRunner;
19 import org.evosuite.runtime.EvoRunnerParameters;
20 import org.evosuite.runtime.PrivateAccess;
21 import org.evosuite.runtime.ViolatedAssumptionAnswer;
22 import org.junit.runner.RunWith;
23 import org.openecomp.mso.asdc.installer.IVfModuleData;
24 import org.openecomp.mso.asdc.installer.VfModuleMetaData;
25 import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
26 import org.openecomp.sdc.api.notification.IArtifactInfo;
27 import org.openecomp.sdc.api.notification.INotificationData;
28 import org.openecomp.sdc.api.notification.IResourceInstance;
30 @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
31 public class ASDCNotificationLoggingESTest extends ASDCNotificationLoggingESTestscaffolding {
34 public void test00() throws Throwable {
35 LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
36 VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
37 vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", vfModuleMetaData0);
38 linkedList0.add((IVfModuleData) vfModuleMetaData0);
39 // Undeclared exception!
41 ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
42 fail("Expecting exception: ClassCastException");
44 } catch(ClassCastException e) {
46 // org.openecomp.mso.asdc.installer.VfModuleMetaData cannot be cast to java.lang.String
48 verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
53 public void test01() throws Throwable {
54 List<IArtifactInfo> list0 = (List<IArtifactInfo>) mock(List.class, new ViolatedAssumptionAnswer());
55 doReturn(false).when(list0).isEmpty();
56 doReturn((Iterator) null).when(list0).iterator();
57 doReturn(0).when(list0).size();
58 INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
59 doReturn("rGQA").when(iNotificationData0).getDistributionID();
60 doReturn(list0).when(iNotificationData0).getServiceArtifacts();
61 doReturn("rGQA").when(iNotificationData0).getServiceDescription();
62 doReturn("").when(iNotificationData0).getServiceInvariantUUID();
63 doReturn("").when(iNotificationData0).getServiceName();
64 doReturn("rGQA").when(iNotificationData0).getServiceUUID();
65 doReturn("").when(iNotificationData0).getServiceVersion();
66 // Undeclared exception!
68 ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
69 fail("Expecting exception: NullPointerException");
71 } catch(NullPointerException e) {
73 // no message in exception (getMessage() returned null)
75 verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e);
80 public void test02() throws Throwable {
81 LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
82 LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
83 linkedList0.offerFirst((IResourceInstance) null);
84 INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
85 doReturn("").when(iNotificationData0).getDistributionID();
86 doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
87 doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
88 doReturn("").when(iNotificationData0).getServiceDescription();
89 doReturn("]U5JAkfdX0Cs").when(iNotificationData0).getServiceInvariantUUID();
90 doReturn("jV13a").when(iNotificationData0).getServiceName();
91 doReturn("").when(iNotificationData0).getServiceUUID();
92 doReturn("jV13a").when(iNotificationData0).getServiceVersion();
93 String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
94 assertEquals("ASDC Notification:\nDistributionID:\nServiceName:jV13a\nServiceVersion:jV13a\nServiceUUID:\nServiceInvariantUUID:]U5JAkfdX0Cs\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nNULL\n\n}\n\n", string0);
98 public void test03() throws Throwable {
99 LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
100 LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
101 IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
102 doReturn((List) null).when(iResourceInstance0).getArtifacts();
103 doReturn((String) null).when(iResourceInstance0).getCategory();
104 doReturn((String) null).when(iResourceInstance0).getResourceCustomizationUUID();
105 doReturn((String) null).when(iResourceInstance0).getResourceInstanceName();
106 doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID();
107 doReturn((String) null).when(iResourceInstance0).getResourceName();
108 doReturn((String) null).when(iResourceInstance0).getResourceType();
109 doReturn((String) null).when(iResourceInstance0).getResourceUUID();
110 doReturn((String) null).when(iResourceInstance0).getResourceVersion();
111 doReturn((String) null).when(iResourceInstance0).getSubcategory();
112 linkedList0.add(iResourceInstance0);
113 INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
114 doReturn("").when(iNotificationData0).getDistributionID();
115 doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
116 doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
117 doReturn("").when(iNotificationData0).getServiceDescription();
118 doReturn("").when(iNotificationData0).getServiceInvariantUUID();
119 doReturn("36-s.n1@").when(iNotificationData0).getServiceName();
120 doReturn("36-s.n1@").when(iNotificationData0).getServiceUUID();
121 doReturn("").when(iNotificationData0).getServiceVersion();
122 String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
123 assertEquals("ASDC Notification:\nDistributionID:\nServiceName:36-s.n1@\nServiceVersion:\nServiceUUID:36-s.n1@\nServiceInvariantUUID:\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nResource Instance Info:\nResourceInstanceName:NULL\nResourceCustomizationUUID:NULL\nResourceInvariantUUID:NULL\nResourceName:NULL\nResourceType:NULL\nResourceUUID:NULL\nResourceVersion:NULL\nCategory:NULL\nSubCategory:NULL\nResource Artifacts List:\nNULL\n\n\n}\n\n", string0);
126 @Test(timeout = 4000)
127 public void test04() throws Throwable {
128 INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
129 doReturn((String) null).when(iNotificationData0).getDistributionID();
130 doReturn((List) null).when(iNotificationData0).getResources();
131 doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
132 doReturn((String) null).when(iNotificationData0).getServiceDescription();
133 doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
134 doReturn((String) null).when(iNotificationData0).getServiceName();
135 doReturn((String) null).when(iNotificationData0).getServiceUUID();
136 doReturn((String) null).when(iNotificationData0).getServiceVersion();
137 String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
138 assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0);
141 @Test(timeout = 4000)
142 public void test05() throws Throwable {
143 LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
144 VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
145 Map<String, String> map0 = vfModuleMetaData0.getProperties();
146 IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
147 doReturn((List<String>) null, (List<String>) null).when(iVfModuleData0).getArtifacts();
148 doReturn(map0, map0, (Map<String, String>) null).when(iVfModuleData0).getProperties();
149 doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelDescription();
150 doReturn((String) null, "vfModuleModelName").when(iVfModuleData0).getVfModuleModelInvariantUUID();
151 doReturn("", "").when(iVfModuleData0).getVfModuleModelName();
152 doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelUUID();
153 doReturn("|:\\KD91", "vfModuleModelName").when(iVfModuleData0).getVfModuleModelVersion();
154 doReturn(false, false).when(iVfModuleData0).isBase();
155 linkedList0.add(iVfModuleData0);
156 String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
157 assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:|:\\KD91\nVfModuleModelUUID:vfModuleModelUUID\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:vfModuleModelUUID\nArtifacts UUID List:NULLProperties List:\n}\n\nisBase:false\n\n\n}\n", string0);
159 String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
160 assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:vfModuleModelName\nVfModuleModelUUID:isBase:\nVfModuleModelInvariantUUID:vfModuleModelName\nVfModuleModelDescription:isBase:\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1);
163 @Test(timeout = 4000)
164 public void test06() throws Throwable {
165 LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
166 LinkedList<IVfModuleData> linkedList1 = new LinkedList<IVfModuleData>();
167 IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
168 doReturn((List) null, (List) null).when(iVfModuleData0).getArtifacts();
169 doReturn((Map) null, (Map) null).when(iVfModuleData0).getProperties();
170 doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelDescription();
171 doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelInvariantUUID();
172 doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelName();
173 doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelUUID();
174 doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelVersion();
175 doReturn(false, false).when(iVfModuleData0).isBase();
176 linkedList1.add(iVfModuleData0);
177 String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
178 String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
179 assertTrue(string1.equals((Object)string0));
180 assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1);
183 @Test(timeout = 4000)
184 public void test07() throws Throwable {
185 LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
186 VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
187 linkedList0.add((IVfModuleData) vfModuleMetaData0);
188 UnaryOperator<IVfModuleData> unaryOperator0 = (UnaryOperator<IVfModuleData>) mock(UnaryOperator.class, new ViolatedAssumptionAnswer());
189 doReturn((Object) null).when(unaryOperator0).apply(any());
190 linkedList0.replaceAll(unaryOperator0);
191 String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
192 assertEquals("VfModuleMetaData List:\n{\nNULL\n\n}\n", string0);
195 @Test(timeout = 4000)
196 public void test08() throws Throwable {
197 LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
198 VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
199 linkedList0.add((IVfModuleData) vfModuleMetaData0);
200 // Undeclared exception!
202 ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
203 fail("Expecting exception: NullPointerException");
205 } catch(NullPointerException e) {
207 // no message in exception (getMessage() returned null)
209 verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
213 @Test(timeout = 4000)
214 public void test09() throws Throwable {
215 String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
219 @Test(timeout = 4000)
220 public void test10() throws Throwable {
221 String string0 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null);
222 assertEquals("NULL", string0);
225 @Test(timeout = 4000)
226 public void test11() throws Throwable {
227 LinkedList<IArtifactInfo> linkedList0 = new LinkedList<IArtifactInfo>();
228 INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
229 doReturn("io7<{~.v|%").when(iNotificationData0).getDistributionID();
230 doReturn((List<IResourceInstance>) null).when(iNotificationData0).getResources();
231 doReturn(linkedList0).when(iNotificationData0).getServiceArtifacts();
232 doReturn("io7<{~.v|%").when(iNotificationData0).getServiceDescription();
233 doReturn("io7<{~.v|%").when(iNotificationData0).getServiceInvariantUUID();
234 doReturn("io7<{~.v|%").when(iNotificationData0).getServiceName();
235 doReturn((String) null).when(iNotificationData0).getServiceUUID();
236 doReturn("io7<{~.v|%").when(iNotificationData0).getServiceVersion();
237 String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
238 assertEquals("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0);
240 ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
241 IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
242 doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum();
243 doReturn((String) null).when(iArtifactInfo0).getArtifactDescription();
244 doReturn((String) null).when(iArtifactInfo0).getArtifactName();
245 doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout();
246 doReturn((String) null).when(iArtifactInfo0).getArtifactType();
247 doReturn((String) null).when(iArtifactInfo0).getArtifactURL();
248 doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
249 doReturn((String) null).when(iArtifactInfo0).getArtifactVersion();
250 doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact();
251 doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts();
252 linkedList0.push(iArtifactInfo0);
253 INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
254 doReturn("t2J^4~*i|btm ib&").when(iNotificationData1).getDistributionID();
255 doReturn((List<IResourceInstance>) null).when(iNotificationData1).getResources();
256 doReturn(linkedList0).when(iNotificationData1).getServiceArtifacts();
257 doReturn("N~a W7").when(iNotificationData1).getServiceDescription();
258 doReturn("N~a W7").when(iNotificationData1).getServiceInvariantUUID();
259 doReturn("/&*/=").when(iNotificationData1).getServiceName();
260 doReturn((String) null).when(iNotificationData1).getServiceUUID();
261 doReturn("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n").when(iNotificationData1).getServiceVersion();
262 String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
263 assertEquals("ASDC Notification:\nDistributionID:t2J^4~*i|btm ib&\nServiceName:/&*/=\nServiceVersion:ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n\nServiceUUID:NULL\nServiceInvariantUUID:N~a W7\nServiceDescription:N~a W7\nService Artifacts List:\n{\nService Artifacts Info:\nArtifactName:NULL\nArtifactVersion:NULL\nArtifactType:NULL\nArtifactDescription:NULL\nArtifactTimeout:NULL\nArtifactURL:NULL\nArtifactUUID:NULL\nArtifactChecksum:NULL\nGeneratedArtifact:{NULL\n}\nRelatedArtifacts:NULL\n\n\n}\n\nResource Instances List:\nNULL\n", string1);
266 @Test(timeout = 4000)
267 public void test12() throws Throwable {
268 ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
269 Object object0 = PrivateAccess.callMethod((Class<ASDCNotificationLogging>) ASDCNotificationLogging.class, aSDCNotificationLogging0, "dumpASDCResourcesList", (Object) null, (Class<?>) INotificationData.class);