@Test public void testGetNodeImage() { final String uuid = "0000-1111-2222-3333"; final Node<View, Edge> node = new NodeImpl<>(uuid); final HasExpression hasExpression = mock(HasExpression.class); final String expectedImage = "<image>"; final double wide = 800; final double high = 600; doNothing().when(factory).setExpressionContainerGrid(any(), any()); when(expressionHelper.getOptionalHasExpression(node)).thenReturn(Optional.of(hasExpression)); when(expressionContainerGrid.getWidth()).thenReturn(wide); when(expressionContainerGrid.getHeight()).thenReturn(high); when(viewport.toDataURL(DataURLType.PNG)).thenReturn(expectedImage); final String actualImage = factory.getNodeImage(diagram, node); verify(viewport).setPixelSize(810, 610); verify(factory).setExpressionContainerGrid(diagram, uuid); assertEquals(expectedImage, actualImage); }
String getNodeImage(final Diagram diagram, final Node<View, Edge> node) { if (!hasExpression(node)) { return NONE; } setExpressionContainerGrid(diagram, node.getUUID()); final ExpressionContainerGrid grid = getExpressionContainerGrid(); final Viewport viewport = grid.getViewport(); final int padding = 10; final int wide = (int) (grid.getWidth() + padding); final int high = (int) (grid.getHeight() + padding); viewport.setPixelSize(wide, high); return viewport.toDataURL(DataURLType.PNG); }
DMNDocumentationDRDsFactory { String getNodeImage(final Diagram diagram, final Node<View, Edge> node) { if (!hasExpression(node)) { return NONE; } setExpressionContainerGrid(diagram, node.getUUID()); final ExpressionContainerGrid grid = getExpressionContainerGrid(); final Viewport viewport = grid.getViewport(); final int padding = 10; final int wide = (int) (grid.getWidth() + padding); final int high = (int) (grid.getHeight() + padding); viewport.setPixelSize(wide, high); return viewport.toDataURL(DataURLType.PNG); } }
DMNDocumentationDRDsFactory { String getNodeImage(final Diagram diagram, final Node<View, Edge> node) { if (!hasExpression(node)) { return NONE; } setExpressionContainerGrid(diagram, node.getUUID()); final ExpressionContainerGrid grid = getExpressionContainerGrid(); final Viewport viewport = grid.getViewport(); final int padding = 10; final int wide = (int) (grid.getWidth() + padding); final int high = (int) (grid.getHeight() + padding); viewport.setPixelSize(wide, high); return viewport.toDataURL(DataURLType.PNG); } @Inject  DMNDocumentationDRDsFactory(final SessionManager sessionManager,
                                       final BoxedExpressionHelper expressionHelper); }
DMNDocumentationDRDsFactory { String getNodeImage(final Diagram diagram, final Node<View, Edge> node) { if (!hasExpression(node)) { return NONE; } setExpressionContainerGrid(diagram, node.getUUID()); final ExpressionContainerGrid grid = getExpressionContainerGrid(); final Viewport viewport = grid.getViewport(); final int padding = 10; final int wide = (int) (grid.getWidth() + padding); final int high = (int) (grid.getHeight() + padding); viewport.setPixelSize(wide, high); return viewport.toDataURL(DataURLType.PNG); } @Inject  DMNDocumentationDRDsFactory(final SessionManager sessionManager,
                                       final BoxedExpressionHelper expressionHelper); List<DMNDocumentationDRD> create(final Diagram diagram); }
DMNDocumentationDRDsFactory { String getNodeImage(final Diagram diagram, final Node<View, Edge> node) { if (!hasExpression(node)) { return NONE; } setExpressionContainerGrid(diagram, node.getUUID()); final ExpressionContainerGrid grid = getExpressionContainerGrid(); final Viewport viewport = grid.getViewport(); final int padding = 10; final int wide = (int) (grid.getWidth() + padding); final int high = (int) (grid.getHeight() + padding); viewport.setPixelSize(wide, high); return viewport.toDataURL(DataURLType.PNG); } @Inject  DMNDocumentationDRDsFactory(final SessionManager sessionManager,
                                       final BoxedExpressionHelper expressionHelper); List<DMNDocumentationDRD> create(final Diagram diagram);  }