-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7100f55
commit 75d68ef
Showing
2 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
26 changes: 26 additions & 0 deletions
26
tests/test-base/src/main/java/net/javacrumbs/jsonunit/test/base/RegexBuilder.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,26 @@ | ||
package net.javacrumbs.jsonunit.test.base; | ||
|
||
public class RegexBuilder { | ||
private final String expression; | ||
|
||
private RegexBuilder(String expression) { | ||
this.expression = expression; | ||
} | ||
|
||
static RegexBuilder regex() { | ||
return new RegexBuilder("\"${json-unit.regex}^"); | ||
} | ||
|
||
RegexBuilder str(String staticString) { | ||
return new RegexBuilder(expression + "\\\\Q" + staticString + "\\\\E"); | ||
} | ||
|
||
RegexBuilder exp(String regex) { | ||
return new RegexBuilder(expression + regex); | ||
} | ||
|
||
public String toString() { | ||
return expression + "$\""; | ||
} | ||
|
||
} |