Skip to content

Commit

Permalink
Handle whitespace feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoang Vu Huy committed Dec 26, 2024
1 parent cafb9d6 commit f748e15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ public class BaseDocFactoryGenerateDocumentsIT {

private DocumentTemplate documentTemplate1, documentTemplate2, documentTemplate3;

@SuppressWarnings("deprecation")
@BeforeEach
public void setUp() throws Exception {
docFactory = BaseDocFactory.getInstance()
.withDocumentCreationOptions(
DocumentCreationOptions.getInstance().withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)));
docFactory = BaseDocFactory.getInstance().withDocumentCreationOptions(DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)));

Person person = makePerson();
documentTemplate1 = DocumentTemplate.withTemplate(TEMPLATE_1).putDataAsSourceForSimpleMailMerge(person)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void setup() throws Exception {
@Test
public void defaultDoesNotRemoveWhiteSpaceInPdfEditableFields() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true));
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = DocFactoryTest.makeFile(
Expand All @@ -45,9 +45,8 @@ public void defaultDoesNotRemoveWhiteSpaceInPdfEditableFields() {

@Test
public void removeWhiteSpaceInPdfEditableFields() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)
.hasToRemoveWhiteSpaceInPdfEditableFields(true));
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance().withPdfOptions(
PdfOptions.getInstance().hasToKeepFormFieldsEditable(true).hasToRemoveWhiteSpaceInPdfEditableFields(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = makeFile(
Expand All @@ -61,9 +60,8 @@ public void removeWhiteSpaceInPdfEditableFields() {

@Test
public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_fieldsNotEditable() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(false)
.hasToRemoveWhiteSpaceInPdfEditableFields(true));
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance().withPdfOptions(
PdfOptions.getInstance().hasToKeepFormFieldsEditable(false).hasToRemoveWhiteSpaceInPdfEditableFields(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = makeFile(
Expand All @@ -77,9 +75,8 @@ public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_fieldsNotEditab

@Test
public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_doc() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)
.hasToRemoveWhiteSpaceInPdfEditableFields(true));
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance().withPdfOptions(
PdfOptions.getInstance().hasToKeepFormFieldsEditable(true).hasToRemoveWhiteSpaceInPdfEditableFields(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = makeFile("test/documentTemplate/removingWhiteSpaceInPdfEditableFieldsIT/aDoc.doc");
Expand All @@ -92,9 +89,8 @@ public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_doc()

@Test
public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_docx() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)
.hasToRemoveWhiteSpaceInPdfEditableFields(true));
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance().withPdfOptions(
PdfOptions.getInstance().hasToKeepFormFieldsEditable(true).hasToRemoveWhiteSpaceInPdfEditableFields(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = makeFile("test/documentTemplate/removingWhiteSpaceInPdfEditableFieldsIT/aDocx.docx");
Expand All @@ -107,9 +103,8 @@ public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_docx(

@Test
public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_odt() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)
.hasToRemoveWhiteSpaceInPdfEditableFields(true));
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance().withPdfOptions(
PdfOptions.getInstance().hasToKeepFormFieldsEditable(true).hasToRemoveWhiteSpaceInPdfEditableFields(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = makeFile("test/documentTemplate/removingWhiteSpaceInPdfEditableFieldsIT/anOdt.odt");
Expand All @@ -122,9 +117,8 @@ public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_odt()

@Test
public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_html() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)
.hasToRemoveWhiteSpaceInPdfEditableFields(true));
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance().withPdfOptions(
PdfOptions.getInstance().hasToKeepFormFieldsEditable(true).hasToRemoveWhiteSpaceInPdfEditableFields(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = makeFile("test/documentTemplate/removingWhiteSpaceInPdfEditableFieldsIT/anHtml.html");
Expand All @@ -137,9 +131,8 @@ public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_html(

@Test
public void removeWhiteSpaceInPdfEditableFields_has_no_effect_if_output_is_txt() {
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance()
.withPdfOptions(PdfOptions.getInstance().hasToKeepFormFieldsEditable(true)
.hasToRemoveWhiteSpaceInPdfEditableFields(true));
DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance().withPdfOptions(
PdfOptions.getInstance().hasToKeepFormFieldsEditable(true).hasToRemoveWhiteSpaceInPdfEditableFields(true));
documentTemplate.withDocumentCreationOptions(documentCreationOptions);

File resultFile = makeFile("test/documentTemplate/removingWhiteSpaceInPdfEditableFieldsIT/aTxt.txt");
Expand Down

0 comments on commit f748e15

Please sign in to comment.