Catalog alignment
[sdc.git] / catalog-dao / src / test / java / org / openecomp / sdc / be / dao / jsongraph / JanusGraphDaoMockTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.dao.jsongraph;
22
23 import org.janusgraph.core.JanusGraph;
24 import org.janusgraph.core.JanusGraphVertex;
25 import fj.data.Either;
26 import mockit.Deencapsulation;
27 import org.apache.commons.lang3.tuple.ImmutablePair;
28 import org.apache.tinkerpop.gremlin.structure.Direction;
29 import org.apache.tinkerpop.gremlin.structure.Edge;
30 import org.apache.tinkerpop.gremlin.structure.Element;
31 import org.apache.tinkerpop.gremlin.structure.Vertex;
32 import org.junit.Before;
33 import org.junit.Test;
34 import org.mockito.InjectMocks;
35 import org.mockito.Mock;
36 import org.mockito.Mockito;
37 import org.mockito.MockitoAnnotations;
38 import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
39 import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
40 import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
41 import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
42 import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
43 import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
44 import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
45
46 import java.util.HashMap;
47 import java.util.Iterator;
48 import java.util.List;
49 import java.util.Map;
50
51 public class JanusGraphDaoMockTest {
52
53         @InjectMocks
54         JanusGraphDao testSubject;
55
56         @Mock
57         JanusGraphClient janusGraphClient;
58
59         @Before
60         public void setUp() throws Exception {
61                 MockitoAnnotations.initMocks(this);
62         }
63
64         @Test
65         public void testCommit() throws Exception {
66                 JanusGraphOperationStatus result;
67
68                 // default test
69                 result = testSubject.commit();
70         }
71
72         @Test
73         public void testRollback() throws Exception {
74                 JanusGraphOperationStatus result;
75
76                 // default test
77                 result = testSubject.rollback();
78         }
79
80         @Test
81         public void testGetGraph() throws Exception {
82
83                 Either<JanusGraph, JanusGraphOperationStatus> result;
84
85                 // default test
86
87                 result = testSubject.getGraph();
88         }
89
90         @Test
91         public void testCreateVertex() throws Exception {
92
93                 GraphVertex graphVertex = new GraphVertex();
94                 graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
95                 Either<GraphVertex, JanusGraphOperationStatus> result;
96
97                 JanusGraph tg = Mockito.mock(JanusGraph.class);
98                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
99                 // default test
100                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
101                 Mockito.when(tg.addVertex()).thenReturn(value2);
102                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
103                 result = testSubject.createVertex(graphVertex);
104         }
105
106         @Test
107         public void testCreateVertexErrorGetGraph() throws Exception {
108
109                 GraphVertex graphVertex = new GraphVertex();
110                 graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
111                 Either<GraphVertex, JanusGraphOperationStatus> result;
112
113                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
114                 // default test
115                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
116                 result = testSubject.createVertex(graphVertex);
117         }
118
119         @Test
120         public void testCreateVertexException() throws Exception {
121
122                 GraphVertex graphVertex = new GraphVertex();
123                 graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION);
124                 Either<GraphVertex, JanusGraphOperationStatus> result;
125
126                 JanusGraph tg = Mockito.mock(JanusGraph.class);
127                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
128                 // default test
129                 Mockito.when(tg.addVertex()).thenThrow(RuntimeException.class);
130                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
131                 result = testSubject.createVertex(graphVertex);
132         }
133
134         @Test
135         public void testGetVertexByPropertyAndLabel() throws Exception {
136                 Either<GraphVertex, JanusGraphOperationStatus> result;
137
138                 // default test
139                 Mockito.when(janusGraphClient.getGraph()).thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR));
140                 result = testSubject.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, "mock",
141                                 VertexTypeEnum.ADDITIONAL_INFORMATION);
142         }
143
144         @Test
145         public void testGetFirstFoundVertex() throws Exception {
146                 Iterable<JanusGraphVertex> vertices = Mockito.mock(Iterable.class);
147                 Either<GraphVertex, JanusGraphOperationStatus> result;
148
149                 Iterator<JanusGraphVertex> value = Mockito.mock(Iterator.class);
150                 Mockito.when(vertices.iterator()).thenReturn(value);
151                 Mockito.when(value.hasNext()).thenReturn(true);
152                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
153                 Mockito.when(value.next()).thenReturn(value2);
154
155                 // default test
156                 result = Deencapsulation.invoke(testSubject, "getFirstFoundVertex", JsonParseFlagEnum.NoParse, vertices);
157         }
158
159         @Test
160         public void testGetFirstFoundVertexNotFound() throws Exception {
161                 Iterable<JanusGraphVertex> vertices = Mockito.mock(Iterable.class);
162                 Either<GraphVertex, JanusGraphOperationStatus> result;
163
164                 Iterator<JanusGraphVertex> value = Mockito.mock(Iterator.class);
165                 Mockito.when(vertices.iterator()).thenReturn(value);
166                 Mockito.when(value.hasNext()).thenReturn(false);
167                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
168                 Mockito.when(value.next()).thenReturn(value2);
169
170                 // default test
171                 result = Deencapsulation.invoke(testSubject, "getFirstFoundVertex", JsonParseFlagEnum.NoParse, vertices);
172         }
173
174         @Test
175         public void testGetVertexById_1Exception() throws Exception {
176
177                 String id = "mock";
178                 Either<GraphVertex, JanusGraphOperationStatus> result;
179
180                 JanusGraph tg = Mockito.mock(JanusGraph.class);
181                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
182                 // default test
183                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
184                 Mockito.when(tg.addVertex()).thenReturn(value2);
185                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
186
187                 // test 1
188                 result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse);
189                 // Assert.assertEquals(null, result);
190         }
191
192         @Test
193         public void testGetVertexById_1GraphClosed() throws Exception {
194
195                 String id = "mock";
196                 Either<GraphVertex, JanusGraphOperationStatus> result;
197
198                 Object b;
199                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
200                 // default test
201                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
202                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
203
204                 // test 1
205                 result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse);
206                 // Assert.assertEquals(null, result);
207         }
208
209         @Test
210         public void testSetVertexProperties_1() throws Exception {
211                 Vertex vertex = Mockito.mock(Vertex.class);
212                 Map<String, Object> properties = new HashMap<>();
213                 properties.put("mock", "mock");
214
215                 // default test
216                 testSubject.setVertexProperties(vertex, properties);
217         }
218
219         @Test
220         public void testCreateAndFill() throws Exception {
221
222                 JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class);
223                 JsonParseFlagEnum parseFlag = null;
224                 GraphVertex result;
225
226                 // default test
227
228                 result = Deencapsulation.invoke(testSubject, "createAndFill", vertex, JsonParseFlagEnum.NoParse);
229         }
230
231         @Test
232         public void testParseVertexProperties() throws Exception {
233
234                 GraphVertex graphVertex = new GraphVertex();
235                 JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class);
236                 graphVertex.setVertex(vertex);
237                 JsonParseFlagEnum parseFlag = null;
238
239                 // default test
240
241                 testSubject.parseVertexProperties(graphVertex, JsonParseFlagEnum.NoParse);
242         }
243
244
245         @Test
246         public void testCreateEdge() throws Exception {
247
248                 GraphVertex from = Mockito.mock(GraphVertex.class);
249                 GraphVertex to = Mockito.mock(GraphVertex.class);
250                 
251                 JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
252                 Mockito.when(from.getVertex()).thenReturn(value);
253                 Mockito.when(to.getVertex()).thenReturn(value);
254                 Map<EdgePropertyEnum, Object> properties = new HashMap<>();
255                 JanusGraphOperationStatus result;
256
257                 // default test
258
259                 result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties);
260                 from = new GraphVertex();
261                 to = new GraphVertex();
262                 result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties);
263         }
264
265         @Test
266         public void testSetEdgeProperties() throws Exception {
267
268                 Element element = Mockito.mock(Element.class);
269                 Map<EdgePropertyEnum, Object> properties = new HashMap<>();
270
271                 // test 1
272
273                 properties.put(EdgePropertyEnum.STATE, "mock");
274                 testSubject.setEdgeProperties(element, properties);
275         }
276
277         @Test
278         public void testGetByCriteria() throws Exception {
279                 Map<GraphPropertyEnum, Object> props = new HashMap<>();
280                 Either<List<GraphVertex>, JanusGraphOperationStatus> result;
281
282                 JanusGraph tg = Mockito.mock(JanusGraph.class);
283                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.left(tg);
284                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
285                 Mockito.when(tg.addVertex()).thenReturn(value2);
286                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
287                 
288                 // default test
289                 result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props);
290         }
291
292         @Test
293         public void testGetByCriteria_1() throws Exception {
294
295                 Map<GraphPropertyEnum, Object> props = new HashMap<>();
296                 Either<List<GraphVertex>, JanusGraphOperationStatus> result;
297
298                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
299                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
300                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
301
302                 // default test
303                 result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props, JsonParseFlagEnum.NoParse);
304         }
305
306         @Test
307         public void testGetCatalogVerticies() throws Exception {
308                 Either<Iterator<Vertex>, JanusGraphOperationStatus> result;
309
310                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
311                 // default test
312                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
313                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
314                 
315                 // default test
316                 result = testSubject.getCatalogOrArchiveVerticies(true);
317         }
318
319         @Test
320         public void testGetChildVertex() throws Exception {
321
322                 GraphVertex parentVertex = new GraphVertex();
323                 EdgeLabelEnum edgeLabel = null;
324                 JsonParseFlagEnum parseFlag = null;
325                 Either<GraphVertex, JanusGraphOperationStatus> result;
326
327                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
328                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
329                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
330                 
331                 // default test
332                 result = testSubject.getChildVertex(parentVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION, JsonParseFlagEnum.NoParse);
333         }
334
335         @Test
336         public void testGetChildVertex_1() throws Exception {
337
338                 Vertex parentVertex = null;
339                 EdgeLabelEnum edgeLabel = null;
340                 JsonParseFlagEnum parseFlag = null;
341                 Either<Vertex, JanusGraphOperationStatus> result;
342
343                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
344                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
345                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
346
347                 // default test
348                 result = testSubject.getChildVertex(parentVertex, edgeLabel, parseFlag);
349         }
350
351
352         @Test
353         public void testGetParentVertex_1() throws Exception {
354
355                 Vertex parentVertex = null;
356                 EdgeLabelEnum edgeLabel = null;
357                 JsonParseFlagEnum parseFlag = null;
358                 Either<Vertex, JanusGraphOperationStatus> result;
359
360                 // default test
361
362                 result = testSubject.getParentVertex(parentVertex, edgeLabel, parseFlag);
363         }
364
365         @Test
366         public void testGetParentVertecies_1() throws Exception {
367
368                 Vertex parentVertex = null;
369                 EdgeLabelEnum edgeLabel = null;
370                 JsonParseFlagEnum parseFlag = null;
371                 Either<List<Vertex>, JanusGraphOperationStatus> result;
372
373                 // default test
374
375                 result = testSubject.getParentVertices(parentVertex, edgeLabel, parseFlag);
376         }
377
378         @Test
379         public void testGetAdjacentVerticies() throws Exception {
380
381                 Vertex parentVertex = null;
382                 EdgeLabelEnum edgeLabel = null;
383                 JsonParseFlagEnum parseFlag = null;
384                 Direction direction = null;
385                 Either<List<Vertex>, JanusGraphOperationStatus> result;
386
387                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
388                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
389                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
390                 // default test
391                 result = Deencapsulation.invoke(testSubject, "getAdjacentVertices",
392                                 new Object[] { Vertex.class, EdgeLabelEnum.class, JsonParseFlagEnum.class, Direction.class });
393         }
394
395         @Test
396         public void testGetChildrenVertecies_1() throws Exception {
397
398                 Vertex parentVertex = null;
399                 EdgeLabelEnum edgeLabel = null;
400                 JsonParseFlagEnum parseFlag = null;
401                 Either<List<Vertex>, JanusGraphOperationStatus> result;
402
403                 // default test
404
405                 result = testSubject.getChildrenVertices(parentVertex, edgeLabel, parseFlag);
406         }
407
408
409         @Test
410         public void testDeleteBelongingEdgeByCriteria() throws Exception {
411
412                 GraphVertex vertex = null;
413                 EdgeLabelEnum label = null;
414                 Map<GraphPropertyEnum, Object> properties = null;
415                 Either<Edge, JanusGraphOperationStatus> result;
416
417                 // default test
418
419                 result = testSubject.deleteBelongingEdgeByCriteria(vertex, label, properties);
420         }
421
422         @Test
423         public void testDeleteEdge() throws Exception {
424
425                 GraphVertex fromVertex = new GraphVertex();
426                 GraphVertex toVertex = new GraphVertex();
427                 Either<Edge, JanusGraphOperationStatus> result;
428
429                 Either<JanusGraph, JanusGraphOperationStatus> value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
430                 JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class);
431                 Mockito.when(janusGraphClient.getGraph()).thenReturn(value);
432                 
433                 // default test
434                 result = testSubject.deleteEdge(fromVertex, toVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION);
435         }
436
437         @Test
438         public void testDeleteEdgeByDirection() throws Exception {
439                 GraphVertex fromVertex = new GraphVertex();
440                 JanusGraphOperationStatus result;
441
442                 // default test
443                 result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION);
444         }
445
446         @Test
447         public void testDeleteEdgeByDirectionMock() throws Exception {
448                 GraphVertex fromVertex = Mockito.mock(GraphVertex.class);
449                 JanusGraphOperationStatus result;
450
451                 JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);;
452                 Mockito.when(fromVertex.getVertex()).thenReturn(value);
453                 Iterator<Edge> value2 = Mockito.mock(Iterator.class);;
454                 Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(value2);
455                 Mockito.when(value2.hasNext()).thenReturn(true, false);
456                 Edge value3 = Mockito.mock(Edge.class);;
457                 Mockito.when(value2.next()).thenReturn(value3);
458                 // default test
459                 result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION);
460         }
461         
462         @Test
463         public void testUpdateVertex() throws Exception {
464
465                 GraphVertex graphVertex = new GraphVertex();
466                 Either<GraphVertex, JanusGraphOperationStatus> result;
467
468                 // default test
469
470                 result = testSubject.updateVertex(graphVertex);
471         }
472
473         @Test
474         public void testGetVerticesByUniqueIdAndParseFlag() throws Exception {
475
476                 Map<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> verticesToGet = new HashMap<>();
477                 Either<Map<String, GraphVertex>, JanusGraphOperationStatus> result;
478                 
479                 // default test
480                 result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet);
481                 ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum> value3 = ImmutablePair.of(GraphPropertyEnum.COMPONENT_TYPE, JsonParseFlagEnum.NoParse);
482                 verticesToGet.put("mock", value3);
483                 try {
484                         result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet);
485                 } catch (Exception e) {
486                         // TODO Auto-generated catch block
487                         e.printStackTrace();
488                 }
489         }
490
491         @Test
492         public void testCreateEdge_2() throws Exception {
493
494                 Vertex from = null;
495                 Vertex to = null;
496                 EdgeLabelEnum label = null;
497                 Edge edgeToCopy = null;
498                 JanusGraphOperationStatus result;
499
500                 // default test
501
502                 result = testSubject.createEdge(from, to, label, edgeToCopy);
503         }
504
505
506         @Test
507         public void testReplaceEdgeLabel() throws Exception {
508
509                 Vertex fromVertex = null;
510                 Vertex toVertex = null;
511                 Edge prevEdge = null;
512                 EdgeLabelEnum prevLabel = null;
513                 EdgeLabelEnum newLabel = null;
514                 JanusGraphOperationStatus result;
515
516                 // default test
517
518                 result = testSubject.replaceEdgeLabel(fromVertex, toVertex, prevEdge, prevLabel, newLabel);
519         }
520
521         @Test
522         public void testUpdateVertexMetadataPropertiesWithJson() throws Exception {
523
524                 Vertex vertex = Mockito.mock(Vertex.class);;
525                 Map<GraphPropertyEnum, Object> properties = new HashMap<>();
526                 properties.put(GraphPropertyEnum.COMPONENT_TYPE, "mock");
527                 JanusGraphOperationStatus result;
528
529                 // default test
530
531                 result = testSubject.updateVertexMetadataPropertiesWithJson(vertex, properties);
532         }
533
534         //TODO Last
535         @Test
536         public void testDisassociateAndDeleteLast() throws Exception {
537
538                 GraphVertex vertex = Mockito.mock(GraphVertex.class);
539                 JanusGraphOperationStatus result;
540                 
541                 JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
542                 Iterator<Edge> mockiter = Mockito.mock(Iterator.class);
543                 Edge nextmock = Mockito.mock(Edge.class);
544                 Mockito.when(vertex.getVertex()).thenReturn(value);
545                 Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter);
546                 Mockito.when(mockiter.hasNext()).thenReturn(true, false);
547                 Mockito.when(mockiter.next()).thenReturn(nextmock);
548                 Vertex secondVertex = Mockito.mock(Vertex.class);
549                 Mockito.when(nextmock.outVertex()).thenReturn(secondVertex);
550                 Mockito.when(nextmock.inVertex()).thenReturn(secondVertex);
551                 Iterator<Edge> restOfEdges = Mockito.mock(Iterator.class);
552                 Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges);
553                 Mockito.when(restOfEdges.hasNext()).thenReturn(false);
554                 
555                 // default test
556                 result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
557         }
558         
559         @Test
560         public void testDisassociateAndDeleteLastOut() throws Exception {
561
562                 GraphVertex vertex = Mockito.mock(GraphVertex.class);
563                 JanusGraphOperationStatus result;
564                 
565                 JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);
566                 Iterator<Edge> mockiter = Mockito.mock(Iterator.class);
567                 Edge nextmock = Mockito.mock(Edge.class);
568                 Mockito.when(vertex.getVertex()).thenReturn(value);
569                 Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter);
570                 Mockito.when(mockiter.hasNext()).thenReturn(true, false);
571                 Mockito.when(mockiter.next()).thenReturn(nextmock);
572                 Vertex secondVertex = Mockito.mock(Vertex.class);
573                 Mockito.when(nextmock.outVertex()).thenReturn(secondVertex);
574                 Mockito.when(nextmock.inVertex()).thenReturn(secondVertex);
575                 Iterator<Edge> restOfEdges = Mockito.mock(Iterator.class);
576                 Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges);
577                 Mockito.when(restOfEdges.hasNext()).thenReturn(false);
578                 
579                 // default test
580                 result = testSubject.disassociateAndDeleteLast(vertex, Direction.IN, EdgeLabelEnum.ADDITIONAL_INFORMATION);
581         }
582         
583         @Test
584         public void testDisassociateAndDeleteLastException() throws Exception {
585
586                 GraphVertex vertex = Mockito.mock(GraphVertex.class);
587                 JanusGraphOperationStatus result;
588                 
589                 Mockito.when(vertex.getVertex()).thenThrow(RuntimeException.class);
590                 
591                 // default test
592                 result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION);
593         }
594
595         @Test
596         public void testMoveEdge() throws Exception {
597
598                 GraphVertex vertexA = new GraphVertex();
599                 GraphVertex vertexB = new GraphVertex();
600                 JanusGraphOperationStatus result;
601
602                 // default test
603
604                 result = testSubject.moveEdge(vertexA, vertexB, EdgeLabelEnum.ADDITIONAL_INFORMATION, Direction.BOTH);
605         }
606 }