-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into fixExporterSelect…
…ionCaseInsensitive * upstream/master: (32 commits) Fix Export to clipboard Dialog icon (#6345) Refactor EntryEditorPreferences (#6245) Update label names Squashed 'src/main/resources/csl-locales/' changes from d0ee4d13c9..79845b087b Squashed 'src/main/resources/csl-styles/' changes from c1793d2..143464e Cite work by @ayaankazerouni Improve performance for loading files (#6332) Add ADR von JUnit vs. AssertJ (#6335) 'Name' textfield on focus instead of 'OK' button when user clicks on 'Add subgroup' option (#6330) Bump jurt from 6.3.2 to 6.4.3 (#6325) Bump unoil from 6.3.2 to 6.4.3 (#6320) Bump ridl from 6.3.2 to 6.4.3 (#6326) Bump classgraph from 4.8.69 to 4.8.71 (#6322) Bump flexmark from 0.61.6 to 0.61.16 (#6318) Bump richtextfx from 0.10.4 to 0.10.5 (#6319) Bump guava from 28.2-jre to 29.0-jre (#6323) Bump flexmark-ext-gfm-tasklist from 0.61.6 to 0.61.16 (#6327) Bump org.beryx.jlink from 2.17.5 to 2.17.7 (#6324) Improve performance massively by fixing a stupid binding mistake (#6316) Fixed missing paste command (#6313) ...
- Loading branch information
Showing
139 changed files
with
1,936 additions
and
1,653 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file not shown.
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,83 @@ | ||
# Use Plain JUnit5 for advanced test assertions | ||
|
||
## Context and Problem Statement | ||
|
||
How to write readable test assertions? | ||
How to write readable test assertions for advanced tests? | ||
|
||
## Considered Options | ||
|
||
* Plain JUnit5 | ||
* Hamcrest | ||
* AssertJ | ||
|
||
## Decision Outcome | ||
|
||
Chosen option: "Plain JUnit5", because comes out best \(see below\). | ||
|
||
### Positive Consequences | ||
|
||
* Tests are more readable | ||
* More easy to write tests | ||
* More readable assertions | ||
|
||
### Negative Consequences | ||
|
||
* More complicated testing leads to more complicated assertions | ||
|
||
## Pros and Cons of the Options | ||
|
||
### Plain JUnit5 | ||
|
||
Homepage: <https://junit.org/junit5/docs/current/user-guide/> | ||
JabRef testing guidelines: <https://devdocs.jabref.org/getting-into-the-code/code-howtos#test-cases> | ||
|
||
Example: | ||
|
||
```java | ||
String actual = markdownFormatter.format(source); | ||
assertTrue(actual.contains("Markup<br />")); | ||
assertTrue(actual.contains("<li>list item one</li>")); | ||
assertTrue(actual.contains("<li>list item 2</li>")); | ||
assertTrue(actual.contains("> rest")); | ||
assertFalse(actual.contains("\n")); | ||
``` | ||
|
||
* Good, because Junit5 is "common Java knowledge" | ||
* Bad, because complex assertions tend to get hard to read | ||
* Bad, because no fluent API | ||
|
||
### Hamcrest | ||
|
||
Homepage: <http://hamcrest.org/JavaHamcrest/> | ||
|
||
* Good, because offers advanced matchers (such as `contains`) | ||
* Bad, because not full fluent API | ||
* Bad, because entry barrier is increased | ||
|
||
### AssertJ | ||
|
||
Homepage: <https://joel-costigliola.github.io/assertj/> | ||
|
||
Example: | ||
|
||
```java | ||
assertThat(markdownFormatter.format(source)) | ||
.contains("Markup<br />") | ||
.contains("<li>list item one</li>") | ||
.contains("<li>list item 2</li>") | ||
.contains("> rest") | ||
.doesNotContain("\n"); | ||
``` | ||
|
||
* Good, because offers fluent assertions | ||
* Good, because allows partial string testing to focus on important parts | ||
* Good, because assertions are more readable | ||
* Bad, because not commonly used | ||
* Bad, because newcomers have to learn an additional language to express test cases | ||
* Bad, because entry barrier is increased | ||
* Bad, because expressions of test cases vary from unit test to unit test | ||
|
||
## Links | ||
|
||
* German comparison between Hamcrest and AssertJ: <https://www.sigs-datacom.de/uploads/tx_dmjournals/philipp_JS_06_15_gRfN.pdf> |
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.