Resolve warning

This commit is contained in:
Balázs Szücs 2025-06-25 22:35:15 +02:00
parent 06f792aa70
commit bcbad15721

View File

@ -503,6 +503,8 @@ class EmlToPdfTest {
@Mock private PDDocument mockPdDocument; @Mock private PDDocument mockPdDocument;
@Mock private TempFileManager mockTempFileManager;
@Test @Test
@DisplayName("Should convert EML to PDF without attachments when not requested") @DisplayName("Should convert EML to PDF without attachments when not requested")
void convertEmlToPdfWithoutAttachments() throws Exception { void convertEmlToPdfWithoutAttachments() throws Exception {
@ -530,7 +532,8 @@ class EmlToPdfTest {
any(), any(),
any(byte[].class), any(byte[].class),
anyString(), anyString(),
anyBoolean())) anyBoolean(),
any(TempFileManager.class)))
.thenReturn(fakePdfBytes); .thenReturn(fakePdfBytes);
byte[] resultPdf = byte[] resultPdf =
@ -540,7 +543,8 @@ class EmlToPdfTest {
emlBytes, emlBytes,
"test.eml", "test.eml",
false, false,
mockPdfDocumentFactory); mockPdfDocumentFactory,
mockTempFileManager);
assertArrayEquals(fakePdfBytes, resultPdf); assertArrayEquals(fakePdfBytes, resultPdf);
@ -556,7 +560,8 @@ class EmlToPdfTest {
any(), any(),
any(byte[].class), any(byte[].class),
anyString(), anyString(),
anyBoolean())); anyBoolean(),
any(TempFileManager.class)));
verify(mockPdfDocumentFactory).load(resultPdf); verify(mockPdfDocumentFactory).load(resultPdf);
} }
} }
@ -595,7 +600,8 @@ class EmlToPdfTest {
any(), any(),
any(byte[].class), any(byte[].class),
anyString(), anyString(),
anyBoolean())) anyBoolean(),
any(TempFileManager.class)))
.thenReturn(fakePdfBytes); .thenReturn(fakePdfBytes);
try (MockedStatic<EmlToPdf> ignored = try (MockedStatic<EmlToPdf> ignored =
@ -616,7 +622,8 @@ class EmlToPdfTest {
emlBytes, emlBytes,
"test.eml", "test.eml",
false, false,
mockPdfDocumentFactory); mockPdfDocumentFactory,
mockTempFileManager);
assertArrayEquals(fakePdfBytes, resultPdf); assertArrayEquals(fakePdfBytes, resultPdf);
@ -632,7 +639,8 @@ class EmlToPdfTest {
any(), any(),
any(byte[].class), any(byte[].class),
anyString(), anyString(),
anyBoolean())); anyBoolean(),
any(TempFileManager.class)));
verify(mockPdfDocumentFactory).load(resultPdf); verify(mockPdfDocumentFactory).load(resultPdf);
} }
@ -657,7 +665,8 @@ class EmlToPdfTest {
any(), any(),
any(byte[].class), any(byte[].class),
anyString(), anyString(),
anyBoolean())) anyBoolean(),
any(TempFileManager.class)))
.thenThrow(new IOException(errorMessage)); .thenThrow(new IOException(errorMessage));
IOException exception = assertThrows( IOException exception = assertThrows(
@ -668,7 +677,8 @@ class EmlToPdfTest {
emlBytes, emlBytes,
"test.eml", "test.eml",
false, false,
mockPdfDocumentFactory)); mockPdfDocumentFactory,
mockTempFileManager));
assertTrue(exception.getMessage().contains(errorMessage)); assertTrue(exception.getMessage().contains(errorMessage));
} }