mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
Merge branch 'main' into thai-stamp-feature
This commit is contained in:
commit
c61ea4e290
@ -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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user