@Test public void validateAfterDownload_resultSizeIsTooBig_ValidationException() throws Exception { final AbbyyInput abbyyInput = mock(AbbyyInput.class); final String targetPath = "dummy"; PowerMockito.mockStatic(Paths.class); PowerMockito.when(Paths.get(anyString())).thenReturn(null); PowerMockito.mockStatic(Files.class); PowerMockito.when(Files.size(any(Path.class))).thenReturn(Limits.MAX_SIZE_OF_PDF_FILE + 1); ValidationException ex = this.sut.validateAfterDownload(abbyyInput, targetPath); assertNotNull(ex); }
public ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String targetPath) throws Exception { try { validateSizeAfterDownload(abbyyInput, targetPath); return null; } catch (ValidationException ex) { return ex; } }
PdfResultValidator implements AbbyyResultValidator { public ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String targetPath) throws Exception { try { validateSizeAfterDownload(abbyyInput, targetPath); return null; } catch (ValidationException ex) { return ex; } } }
PdfResultValidator implements AbbyyResultValidator { public ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String targetPath) throws Exception { try { validateSizeAfterDownload(abbyyInput, targetPath); return null; } catch (ValidationException ex) { return ex; } } PdfResultValidator(@NotNull AbbyyApi abbyyApi); }
PdfResultValidator implements AbbyyResultValidator { public ValidationException validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String targetPath) throws Exception { try { validateSizeAfterDownload(abbyyInput, targetPath); 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 validateAfterDownload(@NotNull AbbyyInput abbyyInput, @NotNull String targetPath) throws Exception { try { validateSizeAfterDownload(abbyyInput, targetPath); 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);  }