4f963032d098abf715db75bb05d1a0696e0f15fb
[so.git] /
1 /*
2  * This file was automatically generated by EvoSuite
3  * Wed Feb 22 12:31:50 GMT 2017
4  */
5
6 package org.openecomp.mso.adapters.catalogrest;
7
8 import org.junit.Test;
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.Collection;
14 import java.util.ConcurrentModificationException;
15 import java.util.LinkedList;
16 import java.util.List;
17 import org.evosuite.runtime.EvoRunner;
18 import org.evosuite.runtime.EvoRunnerParameters;
19 import org.evosuite.runtime.ViolatedAssumptionAnswer;
20 import org.junit.runner.RunWith;
21 import org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs;
22 import org.openecomp.mso.db.catalog.beans.VnfResource;
23
24 @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
25 public class QueryServiceVnfsESTest extends QueryServiceVnfsESTestscaffolding {
26
27     @Test(timeout = 4000)
28     public void test00()  throws Throwable  {
29         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
30         queryServiceVnfs0.setServiceVnfs((List<VnfResource>) null);
31         List<VnfResource> list0 = queryServiceVnfs0.getServiceVnfs();
32         assertNull(list0);
33     }
34
35     @Test(timeout = 4000)
36     public void test01()  throws Throwable  {
37         LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
38         VnfResource vnfResource0 = new VnfResource();
39         linkedList0.add(vnfResource0);
40         List<VnfResource> list0 = linkedList0.subList(1, 1);
41         linkedList0.add(vnfResource0);
42         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
43         queryServiceVnfs0.setServiceVnfs(list0);
44         // Undeclared exception!
45         try {
46             queryServiceVnfs0.toString();
47             fail("Expecting exception: ConcurrentModificationException");
48
49         } catch(ConcurrentModificationException e) {
50             //
51             // no message in exception (getMessage() returned null)
52             //
53             verifyException("java.util.SubList", e);
54         }
55     }
56
57     @Test(timeout = 4000)
58     public void test02()  throws Throwable  {
59         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
60         queryServiceVnfs0.setServiceVnfs((List<VnfResource>) null);
61         // Undeclared exception!
62         try {
63             queryServiceVnfs0.toString();
64             fail("Expecting exception: NullPointerException");
65
66         } catch(NullPointerException e) {
67             //
68             // no message in exception (getMessage() returned null)
69             //
70             verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
71         }
72     }
73
74     @Test(timeout = 4000)
75     public void test03()  throws Throwable  {
76         LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
77         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
78         Object[] objectArray0 = new Object[3];
79         objectArray0[1] = (Object) queryServiceVnfs0;
80         queryServiceVnfs0.setServiceVnfs(linkedList0);
81         Collection<VnfResource> collection0 = (Collection<VnfResource>) mock(Collection.class, new ViolatedAssumptionAnswer());
82         doReturn(objectArray0).when(collection0).toArray();
83         linkedList0.addAll(collection0);
84         // Undeclared exception!
85         try {
86             queryServiceVnfs0.toString();
87             fail("Expecting exception: ClassCastException");
88
89         } catch(ClassCastException e) {
90             //
91             // org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource
92             //
93             verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
94         }
95     }
96
97     @Test(timeout = 4000)
98     public void test04()  throws Throwable  {
99         LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
100         linkedList0.add((VnfResource) null);
101         QueryServiceVnfs queryServiceVnfs0 = null;
102         try {
103             queryServiceVnfs0 = new QueryServiceVnfs((List<VnfResource>) linkedList0);
104             fail("Expecting exception: NullPointerException");
105
106         } catch(NullPointerException e) {
107             //
108             // no message in exception (getMessage() returned null)
109             //
110             verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
111         }
112     }
113
114     @Test(timeout = 4000)
115     public void test05()  throws Throwable  {
116         LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
117         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
118         Object[] objectArray0 = new Object[8];
119         objectArray0[0] = (Object) queryServiceVnfs0;
120         Collection<VnfResource> collection0 = (Collection<VnfResource>) mock(Collection.class, new ViolatedAssumptionAnswer());
121         doReturn(objectArray0).when(collection0).toArray();
122         linkedList0.addAll(0, collection0);
123         QueryServiceVnfs queryServiceVnfs1 = null;
124         try {
125             queryServiceVnfs1 = new QueryServiceVnfs((List<VnfResource>) linkedList0);
126             fail("Expecting exception: ClassCastException");
127
128         } catch(ClassCastException e) {
129             //
130             // org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource
131             //
132             verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
133         }
134     }
135
136     @Test(timeout = 4000)
137     public void test06()  throws Throwable  {
138         LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
139         VnfResource vnfResource0 = new VnfResource();
140         linkedList0.add(vnfResource0);
141         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
142         queryServiceVnfs0.setServiceVnfs(linkedList0);
143         linkedList0.add(vnfResource0);
144         String string0 = queryServiceVnfs0.toString();
145         assertEquals("1\tVNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null,modelCustomizationUuid=nullVfModules: NONE1\t\nVNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null,modelCustomizationUuid=nullVfModules: NONE", string0);
146     }
147
148     @Test(timeout = 4000)
149     public void test07()  throws Throwable  {
150         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
151         String string0 = queryServiceVnfs0.toString();
152         assertEquals("", string0);
153     }
154
155     @Test(timeout = 4000)
156     public void test08()  throws Throwable  {
157         LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
158         VnfResource vnfResource0 = new VnfResource();
159         linkedList0.add(vnfResource0);
160         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs((List<VnfResource>) linkedList0);
161         List<VnfResource> list0 = queryServiceVnfs0.getServiceVnfs();
162         assertEquals(1, list0.size());
163     }
164
165     @Test(timeout = 4000)
166     public void test09()  throws Throwable  {
167         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
168         List<VnfResource> list0 = queryServiceVnfs0.getServiceVnfs();
169         queryServiceVnfs0.setServiceVnfs(list0);
170         assertTrue(list0.isEmpty());
171     }
172
173     @Test(timeout = 4000)
174     public void test10()  throws Throwable  {
175         QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
176         // Undeclared exception!
177         try {
178             queryServiceVnfs0.toJsonString();
179             fail("Expecting exception: VerifyError");
180
181         } catch(VerifyError e) {
182             //
183             // (class: org/codehaus/jackson/map/MapperConfig, method: <clinit> signature: ()V) Bad type in putfield/putstatic
184             //
185             verifyException("org.codehaus.jackson.map.ObjectMapper", e);
186         }
187     }
188 }