-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from goatfryed/chore/project-cleanups
docs: fill TODO sections in docs
- Loading branch information
Showing
6 changed files
with
61 additions
and
6 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
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 |
---|---|---|
@@ -1 +1,29 @@ | ||
[TODO] | ||
# Text Assertions | ||
String assertions require no additional dependency and use simply assertJ. | ||
|
||
```java | ||
import static com.github.goatfryed.assert_baseline.Assertions.assertThatJson; | ||
|
||
assertThatText(yourString) | ||
.isEqualToBaseline("src/test/resources/specs/my.baseline.txt"); | ||
``` | ||
|
||
## Include in your project | ||
For gradle | ||
```groovy | ||
implementation("com.github.goatfryed:assert-baseline:1.0.0-alpha1-SNAPSHOT") {} | ||
``` | ||
|
||
For maven | ||
````xml | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.goatfryed</groupId> | ||
<artifactId>assert-baseline</artifactId> | ||
<version>{version}</version> | ||
</dependency> | ||
</dependencies> | ||
```` | ||
|
||
## Tips & Recipies | ||
`usingTextComparator` is simply an alias for `usingComparator` of assertJ on String subjects |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# Extend with another baseline format | ||
[TODO] | ||
|
||
You can extend [AbstractBaselineAssertion](../src/main/java/io/github/goatfryed/assert_baseline/core/AbstractBaselineAssertion.java) | ||
to implement your own format. | ||
|
||
Compare [JsonBaselineAssertion](../src/main/java/io/github/goatfryed/assert_baseline/json/JsonBaselineAssertion.java) | ||
|
||
(!) This internal API is considered unstable. | ||
|
||
## Extending from AbstractBaselineAssertion | ||
|
||
### 1. implement write | ||
Implement `AbstractBaselineAssertion::saveActual(BaselineContext)`. | ||
Serialize your subject and write it to `BaselineContext::getActualOutputStream` | ||
|
||
### 2. implement verification | ||
Implement `verifyIsEqualToBaseline(BaselineContext context)`. | ||
Usually, you'll want to read from `BaselineContext::getBaselineAsString(), deserialize the baseline, | ||
and then compare the java beans. | ||
|
||
### implement further conventional methods |
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