mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-12-30 20:06:30 +01:00
37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
package stirling.software.SPDF.utils;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
import java.io.IOException;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import stirling.software.SPDF.model.api.converters.HTMLToPdfRequest;
|
|
|
|
public class FileToPdfTest {
|
|
|
|
@Test
|
|
public void testConvertHtmlToPdf() {
|
|
HTMLToPdfRequest request = new HTMLToPdfRequest();
|
|
byte[] fileBytes = new byte[0]; // Sample file bytes
|
|
String fileName = "test.html"; // Sample file name
|
|
boolean htmlFormatsInstalled = true; // Sample boolean value
|
|
|
|
// Check if the method throws IOException
|
|
assertThrows(IOException.class, () -> {
|
|
FileToPdf.convertHtmlToPdf(request, fileBytes, fileName, htmlFormatsInstalled);
|
|
});
|
|
}
|
|
|
|
@Test
|
|
public void testConvertBookTypeToPdf() {
|
|
byte[] bytes = new byte[10]; // Sample bytes
|
|
String originalFilename = "test.epub"; // Sample original filename
|
|
|
|
// Check if the method throws IOException
|
|
assertThrows(IOException.class, () -> {
|
|
FileToPdf.convertBookTypeToPdf(bytes, originalFilename);
|
|
});
|
|
}
|
|
}
|