### Question:
JudgmentContentFileProcessor { public void processJudgmentContentFile(ContentFileTransactionContext context, String downloadedContentFilename, Judgment judgment, String oldJudgmentContentPath) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkNotNull(downloadedContentFilename); Preconditions.checkNotNull(judgment); InputStreamWithFilename judgmentContent = null; try { File downloadedContentFile = new File(downloadedContentDir, downloadedContentFilename); String sourceJudgmentId = judgment.getSourceInfo().getSourceJudgmentId(); judgmentContent = judgmentContentFileExtractor.extractJudgmentContent(downloadedContentFile, sourceJudgmentId); updateContentFileInfo(judgment, judgmentContent.getFilename()); handleContentFile(context, judgmentContent, judgment, oldJudgmentContentPath); } finally { if (judgmentContent != null) { judgmentContent.close(); } } }  void processJudgmentContentFile(ContentFileTransactionContext context, String downloadedContentFilename, Judgment judgment, String oldJudgmentContentPath); @Autowired void setJudgmentContentFileExtractor(JudgmentContentFileExtractor judgmentContentFileExtractor); @Autowired void setJudgmentContentFilePathGenerator(JudgmentContentFilePathGenerator judgmentContentFilePathGenerator); @Autowired void setContentTypeExtractor(ContentTypeExtractor contentTypeExtractor); @Autowired void setContentFileOperationPerformer(ContentFileOperationPerformer contentFileOperationPerformer); void setDownloadedContentDir(String downloadedContentDir);  }### Answer:
@Test public void processJudgmentContentFile_NULL_OLD_CONTENT_PATH() throws IOException { ContentFileTransactionContext transactionContext = mock(ContentFileTransactionContext.class); Judgment judgment = new ConstitutionalTribunalJudgment(); judgment.getSourceInfo().setSourceJudgmentId(sourceJudgmentId); judgmentContentFileProcessor.processJudgmentContentFile(transactionContext, downloadedContentFilename, judgment, null); verify(judgmentContentFileExtractor).extractJudgmentContent(new File(downloadedContentDir, downloadedContentFilename), sourceJudgmentId); verify(judgmentContentFilePathGenerator).generatePath(judgment); verify(contentTypeExtractor).extractContentType(judgmentContentFilename); verify(contentFileOperationPerformer).addFile(transactionContext, contentStream, "/judgment/content/path/judgmentContent.pdf"); verify(contentStreamWithFilename).close(); verifyNoMoreInteractions(judgmentContentFileExtractor, judgmentContentFilePathGenerator, contentTypeExtractor, contentFileOperationPerformer); }
@Test public void processJudgmentContentFile_WITH_OLD_CONTENT_PATH() throws IOException { ContentFileTransactionContext transactionContext = mock(ContentFileTransactionContext.class); Judgment judgment = new ConstitutionalTribunalJudgment(); judgment.getSourceInfo().setSourceJudgmentId(sourceJudgmentId); judgmentContentFileProcessor.processJudgmentContentFile(transactionContext, downloadedContentFilename, judgment, "/judgment/content/path/oldJudgmentContent.pdf"); verify(judgmentContentFileExtractor).extractJudgmentContent(new File(downloadedContentDir, downloadedContentFilename), sourceJudgmentId); verify(judgmentContentFilePathGenerator).generatePath(judgment); verify(contentTypeExtractor).extractContentType(judgmentContentFilename); verify(contentFileOperationPerformer).overwriteFile(transactionContext, contentStream, "/judgment/content/path/judgmentContent.pdf", "/judgment/content/path/oldJudgmentContent.pdf"); verify(contentStreamWithFilename).close(); verifyNoMoreInteractions(judgmentContentFileExtractor, judgmentContentFilePathGenerator, contentTypeExtractor, contentFileOperationPerformer); }