### Question:
LienzoCanvasExport implements CanvasExport<AbstractCanvasHandler> { @Override public String toImageData(final AbstractCanvasHandler canvasHandler, final CanvasURLExportSettings settings) { final LienzoLayer layer = getLayer(canvasHandler); final int[] bounds = boundsProvider.compute(layer, settings); return LienzoLayerUtils.layerToDataURL(layer, getDataType(settings.getUrlDataType()), bounds[0], bounds[1], bounds[2], bounds[3], BG_COLOR); } 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 testToJpgImageData() { tested.toImageData(canvasHandler, CanvasURLExportSettings.build(JPG)); verify(context2D, times(1)).setFillColor(eq(LienzoCanvasExport.BG_COLOR)); verify(context2D, times(1)).fillRect(eq(0d), eq(0d), eq(100d), eq(200d)); verify(layer, times(1)).drawWithTransforms(eq(context2D), eq(1d), any(BoundingBox.class)); verify(scratchPad, times(1)).toDataURL(eq(DataURLType.JPG), eq(1d)); verify(scratchPad, times(1)).clear(); }
@Test public void testToPngImageData() { tested.toImageData(canvasHandler, CanvasURLExportSettings.build(PNG)); verify(context2D, times(1)).setFillColor(eq(LienzoCanvasExport.BG_COLOR)); verify(context2D, times(1)).fillRect(eq(0d), eq(0d), eq(100d), eq(200d)); verify(layer, times(1)).drawWithTransforms(eq(context2D), eq(1d), any(BoundingBox.class)); verify(scratchPad, times(1)).toDataURL(eq(DataURLType.PNG), eq(1d)); verify(scratchPad, times(1)).clear(); }