@Test public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(graph, times(1)).clear(); verify(graphIndex, times(1)).clear(); }
@Test @SuppressWarnings("unchecked") public void testExecute() { final CommandResult<CanvasViolation> result = tested.execute(canvasHandler); assertNotEquals(CommandResult.Type.ERROR, result.getType()); verify(canvasHandler, times(1)).removeChild(eq(PARENT_ID), eq(CHILD_ID)); verify(canvasHandler, times(1)).applyElementMutation(eq(parent), any(MutationContext.class)); verify(canvasHandler, times(1)).applyElementMutation(eq(child), any(MutationContext.class)); }
@Test @SuppressWarnings("unchecked") public void testAllow() { CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(containmentRuleManager, times(0)).evaluate(any(Element.class), any(Element.class)); verify(cardinalityRuleManager, times(0)) .evaluate(any(Graph.class), any(Node.class), any(RuleManager.Operation.class)); verify(connectionRuleManager, times(0)) .evaluate(any(Edge.class), any(Node.class), any(Node.class)); verify(edgeCardinalityRuleManager, times(0)) .evaluate( any(Edge.class), any(Node.class), any(List.class), any(EdgeCardinalityRule.Type.class), any(RuleManager.Operation.class)); verify(dockingRuleManager, times(0)).evaluate(any(Element.class), any(Element.class)); }
@Test(expected = BadCommandArgumentsException.class) public void testAllowWithNonExistingRootUUID() { this.tested = new ClearGraphCommand("someId"); CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.ERROR, result.getType()); }