### Question:
LienzoCanvasExport implements CanvasExport<AbstractCanvasHandler> { @Override public IContext2D toContext2D(final AbstractCanvasHandler canvasHandler, final CanvasExportSettings settings) { final LienzoLayer layer = getLayer(canvasHandler); final com.ait.lienzo.client.core.shape.Layer lienzoLayer = layer.getLienzoLayer(); final Viewport viewport = lienzoLayer.getViewport(); final int[] bounds = boundsProvider.compute(layer, settings); final IContext2D svgContext2D = Context2DFactory.create(new SvgExportSettings(bounds[2], bounds[3], lienzoLayer.getContext())); final Transform transform = viewport.getTransform(); viewport.setTransform(new Transform()); lienzoLayer.draw(new Context2D(new DelegateNativeContext2D(svgContext2D, canvasHandler))); viewport.setTransform(transform); lienzoLayer.draw(); return svgContext2D; } LienzoCanvasExport();   LienzoCanvasExport(final BoundsProvider boundsProvider); @Override IContext2D toContext2D(final AbstractCanvasHandler canvasHandler,
                                  final CanvasExportSettings settings); @Override String toImageData(final AbstractCanvasHandler canvasHandler,
                              final CanvasURLExportSettings settings); static final String BG_COLOR; static final int PADDING; }### Answer:
@Test public void testToContext2D() { Transform transform = new Transform().translate(11, 33).scale(0.1, 0.3); when(viewport.getTransform()).thenReturn(transform); IContext2D iContext2D = tested.toContext2D(canvasHandler, CanvasExportSettings.build()); assertNotNull(iContext2D); verify(layer, times(1)).draw(any(Context2D.class)); ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class); verify(viewport, times(2)).setTransform(transformArgumentCaptor.capture()); verify(layer).draw(); List<Transform> transforms = transformArgumentCaptor.getAllValues(); Transform t0 = transforms.get(0); Transform t1 = transforms.get(1); assertEquals(0d, t0.getTranslateX(), 0d); assertEquals(0d, t0.getTranslateY(), 0d); assertEquals(1d, t0.getScaleX(), 0d); assertEquals(1d, t0.getScaleY(), 0d); assertEquals(11d, t1.getTranslateX(), 0d); assertEquals(33d, t1.getTranslateY(), 0d); assertEquals(0.1d, t1.getScaleX(), 0d); assertEquals(0.3d, t1.getScaleY(), 0d); }