-
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 branch 'release/1.3.0' into main
- Loading branch information
Showing
56 changed files
with
713 additions
and
211 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,124 @@ | ||
_Note:_ When running your tests with this version for the first time, you will see that your snapshot files are being | ||
changed because we introduced a new header field. You can and safely check in these changes into your SCM. | ||
|
||
* Fix a regression introduced with `1.2.2` where the framework ends up in unrecoverable condition after a snapshot test failed | ||
* Remove Target `ElementType.METHOD` from `@EnableSnapshotTests` | ||
* [#9](https://github.com/skuzzle/snapshot-tests/issues/9): Do not allow null snapshots anymore | ||
* [#24](https://github.com/skuzzle/snapshot-tests/issues/24): Only create snapshot directory if necessary | ||
* Simple API to specify custom rules using XPath for XML comparison | ||
* Change: Custom json matchers are only tested against the new actual result and not against the persisted snapshot anymore | ||
* Add convenience method `TestFile.asText()` which defaults to use UTF-8 as file encoding | ||
|
||
### Experimental | ||
* Fix: object traversal failed on primitive arrays | ||
* Fix: serious bug in `ObjectMemberAction.replaceConsistently` | ||
* Add: new simpler overload of `ObjectMemberAction.replaceConsistently` | ||
* Add: new package for string normalization | ||
|
||
Maven Central coordinates for this release: | ||
|
||
## BOM Artifact | ||
Manages the versions of all modules in case you are using multiple in your project | ||
|
||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.2.3&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-bom/1.2.3/jar) | ||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-bom/1.3.0/jar) | ||
|
||
```xml | ||
<dependency> | ||
<groupId>de.skuzzle.test</groupId> | ||
<artifactId>snapshot-tests-bom</artifactId> | ||
<version>1.2.3</version> | ||
<version>1.3.0</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
``` | ||
|
||
``` | ||
testImplementation(platform("de.skuzzle.test:snapshot-tests-bom:1.2.3")) | ||
testImplementation(platform("de.skuzzle.test:snapshot-tests-bom:1.3.0")) | ||
``` | ||
|
||
## Artifacts | ||
If you only need text based snapshots: | ||
|
||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.2.3&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-core/1.2.3/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.2.3&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-core/1.2.3) | ||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-core/1.3.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-core/1.3.0) | ||
|
||
```xml | ||
<dependency> | ||
<groupId>de.skuzzle.test</groupId> | ||
<artifactId>snapshot-tests-core</artifactId> | ||
<version>1.2.3</version> | ||
<version>1.3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
``` | ||
testImplementation 'de.skuzzle.test:snapshot-tests-core:1.2.3' | ||
testImplementation("de.skuzzle.test:snapshot-tests-core:1.2.3") | ||
testImplementation 'de.skuzzle.test:snapshot-tests-core:1.3.0' | ||
testImplementation("de.skuzzle.test:snapshot-tests-core:1.3.0") | ||
``` | ||
|
||
If you need json based snapshots (includes `-core`): | ||
|
||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.2.3&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-jackson/1.2.3/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.2.3&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-jackson/1.2.3) | ||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-jackson/1.3.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-jackson/1.3.0) | ||
|
||
```xml | ||
<dependency> | ||
<groupId>de.skuzzle.test</groupId> | ||
<artifactId>snapshot-tests-jackson</artifactId> | ||
<version>1.2.3</version> | ||
<version>1.3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
``` | ||
testImplementation 'de.skuzzle.test:snapshot-tests-jackson:1.2.3' | ||
testImplementation("de.skuzzle.test:snapshot-tests-jackson:1.2.3") | ||
testImplementation 'de.skuzzle.test:snapshot-tests-jackson:1.3.0' | ||
testImplementation("de.skuzzle.test:snapshot-tests-jackson:1.3.0") | ||
``` | ||
|
||
If you need xml based snapshots (includes `-core`): | ||
|
||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.2.3&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-jaxb/1.2.3/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.2.3&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-jaxb/1.2.3) | ||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-jaxb/1.3.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-jaxb/1.3.0) | ||
|
||
```xml | ||
<dependency> | ||
<groupId>de.skuzzle.test</groupId> | ||
<artifactId>snapshot-tests-jaxb</artifactId> | ||
<version>1.2.3</version> | ||
<version>1.3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
``` | ||
testImplementation 'de.skuzzle.test:snapshot-tests-jaxb:1.2.3' | ||
testImplementation("de.skuzzle.test:snapshot-tests-jaxb:1.2.3") | ||
testImplementation 'de.skuzzle.test:snapshot-tests-jaxb:1.3.0' | ||
testImplementation("de.skuzzle.test:snapshot-tests-jaxb:1.3.0") | ||
``` | ||
|
||
## Experimental | ||
Directory Params | ||
|
||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.2.3&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-directory-params/1.2.3/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.2.3&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-directory-params/1.2.3) | ||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-directory-params/1.3.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-directory-params/1.3.0) | ||
|
||
```xml | ||
<dependency> | ||
<groupId>de.skuzzle.test</groupId> | ||
<artifactId>snapshot-tests-directory-params</artifactId> | ||
<version>1.2.3</version> | ||
<version>1.3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
``` | ||
testImplementation 'de.skuzzle.test:snapshot-tests-directory-params:1.2.3' | ||
testImplementation("de.skuzzle.test:snapshot-tests-directory-params:1.2.3") | ||
testImplementation 'de.skuzzle.test:snapshot-tests-directory-params:1.3.0' | ||
testImplementation("de.skuzzle.test:snapshot-tests-directory-params:1.3.0") | ||
``` | ||
|
||
Object normalization | ||
|
||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.2.3&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-normalize/1.2.3/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.2.3&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-normalize/1.2.3) | ||
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=1.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.test/snapshot-tests-normalize/1.3.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=1.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.test/snapshot-tests-normalize/1.3.0) | ||
|
||
```xml | ||
<dependency> | ||
<groupId>de.skuzzle.test</groupId> | ||
<artifactId>snapshot-tests-normalize</artifactId> | ||
<version>1.2.3</version> | ||
<version>1.3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
``` | ||
testImplementation 'de.skuzzle.test:snapshot-tests-normalize:1.2.3' | ||
testImplementation("de.skuzzle.test:snapshot-tests-normalize:1.2.3") | ||
testImplementation 'de.skuzzle.test:snapshot-tests-normalize:1.3.0' | ||
testImplementation("de.skuzzle.test:snapshot-tests-normalize:1.3.0") | ||
``` |
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
62 changes: 62 additions & 0 deletions
62
snapshot-tests-core/src/main/java/de/skuzzle/test/snapshots/ComparisonRuleBuilder.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,62 @@ | ||
package de.skuzzle.test.snapshots; | ||
|
||
import java.util.function.Predicate; | ||
import java.util.regex.Pattern; | ||
|
||
import org.apiguardian.api.API; | ||
import org.apiguardian.api.API.Status; | ||
|
||
/** | ||
* Builder for customizing how snapshot files are compared against the actual test result. | ||
* | ||
* @author Simon Taddiken | ||
* @since 1.2.0 | ||
*/ | ||
@API(status = Status.EXPERIMENTAL, since = "1.3.0") | ||
public interface ComparisonRuleBuilder { | ||
|
||
/** | ||
* Specify the path for which to apply the custom comparison rule. | ||
* | ||
* @param path The dot separated path. | ||
* @return A DSL Object for specifying how to compare values rooted at that path. | ||
*/ | ||
ChooseMatcher pathAt(String path); | ||
|
||
/** | ||
* Allows to choose the comparison for the value. | ||
* | ||
* @author Simon Taddiken | ||
*/ | ||
@API(status = Status.EXPERIMENTAL, since = "1.3.0") | ||
public interface ChooseMatcher { | ||
|
||
/** | ||
* Ignores values during comparison. | ||
* | ||
* @return DSL object for specifying further rules. | ||
*/ | ||
ComparisonRuleBuilder ignore(); | ||
|
||
/** | ||
* String representation of the value must match the given regex. | ||
* | ||
* @param regex The regex. | ||
* @return DSL object for specifying further rules. | ||
*/ | ||
ComparisonRuleBuilder mustMatch(Pattern regex); | ||
|
||
/** | ||
* The value must match the given predicate. | ||
* <p> | ||
* The values which will be passed to the given predicate are highly provider | ||
* specific. Consult the documentation of your {@link StructuredDataProvider} | ||
* implementation. | ||
* | ||
* @param predicate The predicate. | ||
* @return DSL object for specifying further rules. | ||
*/ | ||
ComparisonRuleBuilder mustMatch(Predicate<? super Object> predicate); | ||
} | ||
|
||
} |
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.