-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.9.0: Rewrite tests from JUnit4 to JUnit5
- Loading branch information
Showing
20 changed files
with
115 additions
and
47 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="tests" type="JUnit" factoryName="JUnit"> | ||
<module name="pdf-test.test" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="com.codeborne.pdftest.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="com.codeborne.pdftest" /> | ||
<option name="MAIN_CLASS_NAME" value="" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="package" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | ||
<option name="TEST_SEARCH_SCOPE"> | ||
<value defaultName="moduleWithDependencies" /> | ||
</option> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
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
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
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
37 changes: 37 additions & 0 deletions
37
src/test/java/com/codeborne/pdftest/SoftAssertionsTest.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,37 @@ | ||
package com.codeborne.pdftest; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.opentest4j.MultipleFailuresError; | ||
|
||
import java.io.IOException; | ||
|
||
import static com.codeborne.pdftest.PDF.containsExactText; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertAll; | ||
|
||
public class SoftAssertionsTest { | ||
@Test | ||
public void canUseSoftAssertions() throws IOException { | ||
PDF pdf = new PDF(getClass().getClassLoader().getResource("minimal.pdf")); | ||
|
||
assertThatThrownBy(() -> { | ||
assertAll("minimal PDF", | ||
() -> assertThat(pdf, containsExactText("one")), | ||
() -> assertThat(pdf, containsExactText("two")), | ||
() -> assertThat(pdf, containsExactText("three")), | ||
() -> assertThat(pdf, containsExactText("four")) | ||
); | ||
}) | ||
.isInstanceOf(MultipleFailuresError.class) | ||
.hasMessageStartingWith("minimal PDF (4 failures)") | ||
.isInstanceOfSatisfying(MultipleFailuresError.class, (MultipleFailuresError e) -> { | ||
Assertions.assertThat(e.getFailures()).hasSize(4); | ||
Assertions.assertThat(e.getFailures().get(0)).hasMessageContaining("Expected: a PDF containing \"one\""); | ||
Assertions.assertThat(e.getFailures().get(1)).hasMessageContaining("Expected: a PDF containing \"two\""); | ||
Assertions.assertThat(e.getFailures().get(2)).hasMessageContaining("Expected: a PDF containing \"three\""); | ||
Assertions.assertThat(e.getFailures().get(3)).hasMessageContaining("Expected: a PDF containing \"four\""); | ||
}); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/test/java/com/codeborne/pdftest/assertj/ContainsExactTextTest.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
3 changes: 1 addition & 2 deletions
3
src/test/java/com/codeborne/pdftest/assertj/ContainsTextCaseInsensitiveTest.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
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
2 changes: 1 addition & 1 deletion
2
src/test/java/com/codeborne/pdftest/assertj/MatchRegexTest.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
2 changes: 1 addition & 1 deletion
2
src/test/java/com/codeborne/pdftest/assertj/SoftAssertionsTest.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
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
4 changes: 2 additions & 2 deletions
4
src/test/java/com/codeborne/pdftest/matchers/ContainsTextCaseInsensitiveTest.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
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
Oops, something went wrong.