@Test public void validateBeforeDownload_resultSizeIsTooBig_ValidationException() throws Exception { final AbbyyInput abbyyInput = mock(AbbyyInput.class); final String url = "url"; when(this.abbyyApiMock.getResultSize(eq(abbyyInput), eq(url), any(ExportFormat.class))) .thenReturn(Limits.MAX_SIZE_OF_XML_FILE + 1); ValidationException ex = this.sut.validateBeforeDownload(abbyyInput, url); assertNotNull(ex); }
@Override public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } }
XmlResultValidator implements AbbyyResultValidator { @Override public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } }
XmlResultValidator implements AbbyyResultValidator { @Override public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } XmlResultValidator(@NotNull AbbyyApi abbyyApi, @NotNull String xsdSchemaPath); }
XmlResultValidator implements AbbyyResultValidator { @Override public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } XmlResultValidator(@NotNull AbbyyApi abbyyApi, @NotNull String xsdSchemaPath); @Override ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl); @Override ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String result); }
XmlResultValidator implements AbbyyResultValidator { @Override public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } XmlResultValidator(@NotNull AbbyyApi abbyyApi, @NotNull String xsdSchemaPath); @Override ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl); @Override ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String result);  }