mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-17 13:52:14 +01:00
Rename CustomPDDocumentFactory to CustomPDFDocumentFactory across multiple controllers (#3163)
# Description of Changes Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -23,8 +23,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
class RearrangePagesPDFControllerTest {
|
||||
|
||||
@Mock
|
||||
private CustomPDDocumentFactory mockPdfDocumentFactory;
|
||||
@Mock private CustomPDFDocumentFactory mockPdfDocumentFactory;
|
||||
|
||||
private RearrangePagesPDFController sut;
|
||||
|
||||
@@ -81,21 +80,24 @@ class RearrangePagesPDFControllerTest {
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@CsvSource({
|
||||
"1, '0'",
|
||||
"2, '0,1'",
|
||||
"3, '0,2,1'",
|
||||
"4, '0,2,1,3'",
|
||||
"5, '0,3,1,4,2'",
|
||||
"6, '0,3,1,4,2,5'",
|
||||
"10, '0,5,1,6,2,7,3,8,4,9'",
|
||||
"50, '0,25,1,26,2,27,3,28,4,29,5,30,6,31,7,32,8,33,9,34,10,35," +
|
||||
"11,36,12,37,13,38,14,39,15,40,16,41,17,42,18,43,19,44,20,45,21,46," +
|
||||
"22,47,23,48,24,49'"
|
||||
"1, '0'",
|
||||
"2, '0,1'",
|
||||
"3, '0,2,1'",
|
||||
"4, '0,2,1,3'",
|
||||
"5, '0,3,1,4,2'",
|
||||
"6, '0,3,1,4,2,5'",
|
||||
"10, '0,5,1,6,2,7,3,8,4,9'",
|
||||
"50, '0,25,1,26,2,27,3,28,4,29,5,30,6,31,7,32,8,33,9,34,10,35,"
|
||||
+ "11,36,12,37,13,38,14,39,15,40,16,41,17,42,18,43,19,44,20,45,21,46,"
|
||||
+ "22,47,23,48,24,49'"
|
||||
})
|
||||
void oddEvenMerge_multi_test(int totalNumberOfPages, String expectedPageOrder) {
|
||||
List<Integer> newPageOrder = sut.oddEvenMerge(totalNumberOfPages);
|
||||
|
||||
assertNotNull(newPageOrder, "Returning null instead of page order list");
|
||||
assertEquals(Arrays.stream(expectedPageOrder.split(",")).map(Integer::parseInt).toList(), newPageOrder, "Page order doesn't match");
|
||||
assertEquals(
|
||||
Arrays.stream(expectedPageOrder.split(",")).map(Integer::parseInt).toList(),
|
||||
newPageOrder,
|
||||
"Page order doesn't match");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,20 +7,16 @@ import org.mockito.MockitoAnnotations;
|
||||
|
||||
import stirling.software.SPDF.config.RuntimePathConfig;
|
||||
import stirling.software.SPDF.model.api.converters.UrlToPdfRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class ConvertWebsiteToPdfTest {
|
||||
|
||||
@Mock private CustomPDFDocumentFactory mockPdfDocumentFactory;
|
||||
|
||||
@Mock
|
||||
private CustomPDDocumentFactory mockPdfDocumentFactory;
|
||||
|
||||
@Mock
|
||||
private RuntimePathConfig runtimePathConfig;
|
||||
|
||||
@Mock private RuntimePathConfig runtimePathConfig;
|
||||
|
||||
private ConvertWebsiteToPDF convertWebsiteToPDF;
|
||||
|
||||
@@ -38,9 +34,12 @@ public class ConvertWebsiteToPdfTest {
|
||||
UrlToPdfRequest request = new UrlToPdfRequest();
|
||||
request.setUrlInput(invalid_format_Url);
|
||||
// Act
|
||||
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> {
|
||||
convertWebsiteToPDF.urlToPdf(request);
|
||||
});
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> {
|
||||
convertWebsiteToPDF.urlToPdf(request);
|
||||
});
|
||||
// Assert
|
||||
assertEquals("Invalid URL format provided.", thrown.getMessage());
|
||||
}
|
||||
@@ -53,9 +52,12 @@ public class ConvertWebsiteToPdfTest {
|
||||
UrlToPdfRequest request = new UrlToPdfRequest();
|
||||
request.setUrlInput(unreachable_Url);
|
||||
// Act
|
||||
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> {
|
||||
convertWebsiteToPDF.urlToPdf(request);
|
||||
});
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> {
|
||||
convertWebsiteToPDF.urlToPdf(request);
|
||||
});
|
||||
// Assert
|
||||
assertEquals("URL is not reachable, please provide a valid URL.", thrown.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user