aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTest.java
blob: 4f963032d098abf715db75bb05d1a0696e0f15fb (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
/*
 * This file was automatically generated by EvoSuite
 * Wed Feb 22 12:31:50 GMT 2017
 */

package org.openecomp.mso.adapters.catalogrest;

import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.MockitoExtension.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.LinkedList;
import java.util.List;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
import org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs;
import org.openecomp.mso.db.catalog.beans.VnfResource;

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

    @Test(timeout = 4000)
    public void test00()  throws Throwable  {
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        queryServiceVnfs0.setServiceVnfs((List<VnfResource>) null);
        List<VnfResource> list0 = queryServiceVnfs0.getServiceVnfs();
        assertNull(list0);
    }

    @Test(timeout = 4000)
    public void test01()  throws Throwable  {
        LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
        VnfResource vnfResource0 = new VnfResource();
        linkedList0.add(vnfResource0);
        List<VnfResource> list0 = linkedList0.subList(1, 1);
        linkedList0.add(vnfResource0);
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        queryServiceVnfs0.setServiceVnfs(list0);
        // Undeclared exception!
        try {
            queryServiceVnfs0.toString();
            fail("Expecting exception: ConcurrentModificationException");

        } catch(ConcurrentModificationException e) {
            //
            // no message in exception (getMessage() returned null)
            //
            verifyException("java.util.SubList", e);
        }
    }

    @Test(timeout = 4000)
    public void test02()  throws Throwable  {
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        queryServiceVnfs0.setServiceVnfs((List<VnfResource>) null);
        // Undeclared exception!
        try {
            queryServiceVnfs0.toString();
            fail("Expecting exception: NullPointerException");

        } catch(NullPointerException e) {
            //
            // no message in exception (getMessage() returned null)
            //
            verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
        }
    }

    @Test(timeout = 4000)
    public void test03()  throws Throwable  {
        LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        Object[] objectArray0 = new Object[3];
        objectArray0[1] = (Object) queryServiceVnfs0;
        queryServiceVnfs0.setServiceVnfs(linkedList0);
        Collection<VnfResource> collection0 = (Collection<VnfResource>) mock(Collection.class, new ViolatedAssumptionAnswer());
        doReturn(objectArray0).when(collection0).toArray();
        linkedList0.addAll(collection0);
        // Undeclared exception!
        try {
            queryServiceVnfs0.toString();
            fail("Expecting exception: ClassCastException");

        } catch(ClassCastException e) {
            //
            // org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource
            //
            verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
        }
    }

    @Test(timeout = 4000)
    public void test04()  throws Throwable  {
        LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
        linkedList0.add((VnfResource) null);
        QueryServiceVnfs queryServiceVnfs0 = null;
        try {
            queryServiceVnfs0 = new QueryServiceVnfs((List<VnfResource>) linkedList0);
            fail("Expecting exception: NullPointerException");

        } catch(NullPointerException e) {
            //
            // no message in exception (getMessage() returned null)
            //
            verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
        }
    }

    @Test(timeout = 4000)
    public void test05()  throws Throwable  {
        LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        Object[] objectArray0 = new Object[8];
        objectArray0[0] = (Object) queryServiceVnfs0;
        Collection<VnfResource> collection0 = (Collection<VnfResource>) mock(Collection.class, new ViolatedAssumptionAnswer());
        doReturn(objectArray0).when(collection0).toArray();
        linkedList0.addAll(0, collection0);
        QueryServiceVnfs queryServiceVnfs1 = null;
        try {
            queryServiceVnfs1 = new QueryServiceVnfs((List<VnfResource>) linkedList0);
            fail("Expecting exception: ClassCastException");

        } catch(ClassCastException e) {
            //
            // org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource
            //
            verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e);
        }
    }

    @Test(timeout = 4000)
    public void test06()  throws Throwable  {
        LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
        VnfResource vnfResource0 = new VnfResource();
        linkedList0.add(vnfResource0);
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        queryServiceVnfs0.setServiceVnfs(linkedList0);
        linkedList0.add(vnfResource0);
        String string0 = queryServiceVnfs0.toString();
        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);
    }

    @Test(timeout = 4000)
    public void test07()  throws Throwable  {
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        String string0 = queryServiceVnfs0.toString();
        assertEquals("", string0);
    }

    @Test(timeout = 4000)
    public void test08()  throws Throwable  {
        LinkedList<VnfResource> linkedList0 = new LinkedList<VnfResource>();
        VnfResource vnfResource0 = new VnfResource();
        linkedList0.add(vnfResource0);
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs((List<VnfResource>) linkedList0);
        List<VnfResource> list0 = queryServiceVnfs0.getServiceVnfs();
        assertEquals(1, list0.size());
    }

    @Test(timeout = 4000)
    public void test09()  throws Throwable  {
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        List<VnfResource> list0 = queryServiceVnfs0.getServiceVnfs();
        queryServiceVnfs0.setServiceVnfs(list0);
        assertTrue(list0.isEmpty());
    }

    @Test(timeout = 4000)
    public void test10()  throws Throwable  {
        QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs();
        // Undeclared exception!
        try {
            queryServiceVnfs0.toJsonString();
            fail("Expecting exception: VerifyError");

        } catch(VerifyError e) {
            //
            // (class: org/codehaus/jackson/map/MapperConfig, method: <clinit> signature: ()V) Bad type in putfield/putstatic
            //
            verifyException("org.codehaus.jackson.map.ObjectMapper", e);
        }
    }
}