+ verify(abstractNode,times(2)).getSubNode();
+ verify(abstractObjects,times(2)).getAbstractNode();
+ //get into method "checkNodeTemplate" args(abstractNode,map)
+ field.set(updateTemplateDefinition, getDefinitions);
+ when(abstractNode.getNodeType()).thenReturn(mock(NodeType.class));
+ when(getDefinitions.getNodeDefinition()).thenReturn(nodeDefinitions);
+ when(nodeDefinitions.containsKey(any(NodeType.class))).thenReturn(false);
+ Assert.assertTrue(updateTemplateDefinition.checkTemplateDefinition(userId, templateDefinition).equals("The node type " + abstractNode.getNodeType().getValue() + " is not defined."));
+ verify(abstractNode,times(3)).getSubNode();
+ verify(abstractObjects, times(4)).getAbstractNode();
+
+ when(abstractObjects.getAbstractConnection())
+ .thenReturn(connectionList)//1
+ .thenReturn(connectionList)//1
+ .thenReturn(connectionList)//1
+ .thenReturn(connectionList)//1
+ .thenReturn(null)//1
+ .thenReturn(null)//1
+ .thenReturn(connectionList)//2
+ .thenReturn(connectionList);//2
+ when(abstractConnection.getEndNode()).thenReturn(endNodeList);
+ when(endNode.getNodeId()).thenReturn(null);
+ Assert.assertTrue(updateTemplateDefinition.checkTemplateDefinition(userId, templateDefinition).equals("The end node is not exist."));
+ verify(abstractObjects,times(7)).getAbstractNode();
+ verify(abstractObjects,times(2)).getAbstractConnection();
+// Assert.assertTrue(updateTemplateDefinition.checkTemplateDefinition(userId, templateDefinition).equals("The end node is not exist."));
+ Assert.assertTrue(updateTemplateDefinition.checkTemplateDefinition(userId, templateDefinition).equals("There are no end nodes exist."));
+ verify(abstractObjects, times(9)).getAbstractNode();
+ verify(abstractObjects, times(4)).getAbstractConnection();
+
+ when(abstractObjects.getAbstractFlow())
+ .thenReturn(flowList)//1
+ .thenReturn(flowList)//1
+ .thenReturn(null)//1
+ .thenReturn(flowList)//2
+ .thenReturn(flowList);//2
+ //get into method "checkFlowTemplate" args(abstractFlow,map)
+ when(getDefinitions.getMatchItemDefinition()).thenReturn(matchItemDefinitionMap);
+ when(abstractFlow.getMatchItem()).thenReturn(matchItemList);
+ when(matchItem.getMatchItemName()).thenReturn(mock(MatchItemName.class));
+ when(matchItemDefinitionMap.containsKey(any(MatchItemName.class))).thenReturn(false);
+ Assert.assertTrue(updateTemplateDefinition.checkTemplateDefinition(userId, templateDefinition).equals("The match item " + matchItem.getMatchItemName().getValue() + " is not defined."));
+ verify(abstractObjects, times(10)).getAbstractNode();
+ verify(abstractObjects, times(5)).getAbstractConnection();
+ verify(abstractObjects, times(2)).getAbstractFlow();
+
+ when(abstractIntents.getAbstractOperations()).thenReturn(abstractOperations);
+ when(abstractOperations.getAbstractOperation())
+ .thenReturn(operationList)
+ .thenReturn(operationList)
+ .thenReturn(null);
+ when(abstractOperation.getTargetObject()).thenReturn(objectId);
+ Assert.assertTrue(updateTemplateDefinition.checkTemplateDefinition(userId, templateDefinition).equals("The target is not exist."));
+// System.out.println(updateTemplateDefinition.checkTemplateDefinition(userId, templateDefinition) + "dfsfsdfsfds");
+ verify(abstractObjects, times(13)).getAbstractNode();
+ verify(abstractObjects, times(8)).getAbstractConnection();
+ verify(abstractObjects, times(5)).getAbstractFlow();
+