@Test public void testWithException() throws Exception { Path screenshotPath = Paths.get(ScreenshotDivConverter.class.getResource("computer.png").toURI()); assertTrue(Files.exists(screenshotPath)); ScreenshotDiv result = testling.convert(new SakuliExceptionWithScreenshot("test", screenshotPath)); assertNotNull(result); assertEquals(result.getId(), ScreenshotDiv.DEFAULT_SAKULI_SCREENSHOT_DIV_ID + result.hashCode()); assertEquals(result.getBase64screenshot(), base64String); assertEquals(result.getFormat(), "png"); verify(sakuliExceptionHandler, never()).handleException(any(Exception.class)); }
public ScreenshotDiv convert(Exception e) { if (e != null) { String base64String = extractScreenshotAsBase64(e); String format = extractScreenshotFormat(e); if (base64String != null && format != null) { ScreenshotDiv screenshotDiv = new ScreenshotDiv(); screenshotDiv.setFormat(format); screenshotDiv.setBase64screenshot(base64String); screenshotDiv.setId(ScreenshotDiv.DEFAULT_SAKULI_SCREENSHOT_DIV_ID + screenshotDiv.hashCode()); return screenshotDiv; } } return null; }
ScreenshotDivConverter { public ScreenshotDiv convert(Exception e) { if (e != null) { String base64String = extractScreenshotAsBase64(e); String format = extractScreenshotFormat(e); if (base64String != null && format != null) { ScreenshotDiv screenshotDiv = new ScreenshotDiv(); screenshotDiv.setFormat(format); screenshotDiv.setBase64screenshot(base64String); screenshotDiv.setId(ScreenshotDiv.DEFAULT_SAKULI_SCREENSHOT_DIV_ID + screenshotDiv.hashCode()); return screenshotDiv; } } return null; } }
ScreenshotDivConverter { public ScreenshotDiv convert(Exception e) { if (e != null) { String base64String = extractScreenshotAsBase64(e); String format = extractScreenshotFormat(e); if (base64String != null && format != null) { ScreenshotDiv screenshotDiv = new ScreenshotDiv(); screenshotDiv.setFormat(format); screenshotDiv.setBase64screenshot(base64String); screenshotDiv.setId(ScreenshotDiv.DEFAULT_SAKULI_SCREENSHOT_DIV_ID + screenshotDiv.hashCode()); return screenshotDiv; } } return null; }  }
ScreenshotDivConverter { public ScreenshotDiv convert(Exception e) { if (e != null) { String base64String = extractScreenshotAsBase64(e); String format = extractScreenshotFormat(e); if (base64String != null && format != null) { ScreenshotDiv screenshotDiv = new ScreenshotDiv(); screenshotDiv.setFormat(format); screenshotDiv.setBase64screenshot(base64String); screenshotDiv.setId(ScreenshotDiv.DEFAULT_SAKULI_SCREENSHOT_DIV_ID + screenshotDiv.hashCode()); return screenshotDiv; } } return null; }  static String removeBase64ImageDataString(String string); ScreenshotDiv convert(Exception e); }
ScreenshotDivConverter { public ScreenshotDiv convert(Exception e) { if (e != null) { String base64String = extractScreenshotAsBase64(e); String format = extractScreenshotFormat(e); if (base64String != null && format != null) { ScreenshotDiv screenshotDiv = new ScreenshotDiv(); screenshotDiv.setFormat(format); screenshotDiv.setBase64screenshot(base64String); screenshotDiv.setId(ScreenshotDiv.DEFAULT_SAKULI_SCREENSHOT_DIV_ID + screenshotDiv.hashCode()); return screenshotDiv; } } return null; }  static String removeBase64ImageDataString(String string); ScreenshotDiv convert(Exception e); static final String REGEX_SRC_DATA_IMAGE_BASE64; }