@Test public void validateBeforeDownload_resultValid_NullReturned() 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_PDF_FILE - 1); when(this.abbyyApiMock.getResultChunk(eq(abbyyInput), eq(url), any(ExportFormat.class), anyInt(), anyInt())) .thenReturn("%PDF"); ValidationException ex = this.sut.validateBeforeDownload(abbyyInput, url); assertNull(ex); }
public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); validateFileType(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } }
PdfResultValidator implements AbbyyResultValidator { public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); validateFileType(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } }
PdfResultValidator implements AbbyyResultValidator { public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); validateFileType(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } PdfResultValidator(@NotNull AbbyyApi abbyyApi); }
PdfResultValidator implements AbbyyResultValidator { public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); validateFileType(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } PdfResultValidator(@NotNull AbbyyApi abbyyApi); ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl); ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String targetPath); }
PdfResultValidator implements AbbyyResultValidator { public ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl) throws Exception { try { validateSizeBeforeDownload(abbyyInput, downloadUrl); validateFileType(abbyyInput, downloadUrl); return null; } catch (ValidationException ex) { return ex; } } PdfResultValidator(@NotNull AbbyyApi abbyyApi); ValidationException validateBeforeDownload(@NotNull AbbyyInput abbyyInput, @NotNull String downloadUrl); ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String targetPath);  }