-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added Test for changed Method - Added localization for exception message
- Loading branch information
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
openpdf/src/test/java/com/lowagie/text/pdf/PdfPTableTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.lowagie.text.pdf; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
import com.lowagie.text.DocumentException; | ||
import com.lowagie.text.error_messages.MessageLocalization; | ||
import java.io.IOException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class PdfPTableTest { | ||
|
||
@Test | ||
void whenAddCellWithSelf_shouldThrowException() { | ||
PdfPTable table = new PdfPTable(1); | ||
assertThatThrownBy(() -> table.addCell(table)) | ||
.isInstanceOf(DocumentException.class) | ||
.hasMessage("Unable to add self to table contents."); | ||
} | ||
|
||
@Test | ||
void whenAddCellWithSelf_shouldThrowException_pt() throws IOException { | ||
MessageLocalization.setLanguage("pt", null); | ||
PdfPTable table = new PdfPTable(1); | ||
assertThatThrownBy(() -> table.addCell(table)) | ||
.isInstanceOf(DocumentException.class) | ||
.hasMessage("Não é possível adicionar a si mesmo ao conteúdo da tabela."); | ||
MessageLocalization.setLanguage("en", null); | ||
} | ||
|
||
|
||
} |