Unable to create custom StringValuePattern
See original GitHub issueHi,
I wanted to create my own custom StringValuePattern
in my project but unfortunately I’m not able to do so due to this Map present in StringValuePatternJsonDeserializer
which maps StringValuePattern
s to json names (I’m getting JsonMappingException: null is not a valid comparison
):
private static final Map<String, Class<? extends StringValuePattern>> PATTERNS =
new ImmutableMap.Builder<String, Class<? extends StringValuePattern>>()
.put("equalTo", EqualToPattern.class)
.put("equalToJson", EqualToJsonPattern.class)
.put("matchesJsonPath", MatchesJsonPathPattern.class)
.put("equalToXml", EqualToXmlPattern.class)
.put("matchesXPath", MatchesXPathPattern.class)
.put("contains", ContainsPattern.class)
.put("matches", RegexPattern.class)
.put("doesNotMatch", NegativeRegexPattern.class)
.put("anything", AnythingPattern.class)
.build();
Am I missing something or is it really currently not possible to create custom StringValuePattern
?
Why this json name is stored in private Map and not set as annotation on each StringValuePattern
class?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Unable to create custom StringValuePattern #834 - GitHub
Hi, I wanted to create my own custom StringValuePattern in my project but unfortunately I'm not able to do so due to this...
Read more >java - No such method exception when creating a wiremock stub
After I make a call to mockApiWithRequestBody, I am getting the exception: java.lang. ... getName(StringValuePattern.java:54) at ...
Read more >Request Matching - WireMock
Multipart/form-data. Here's an example showing all attributes being matched using WireMock's in-built match operators. It is also possible to write custom ...
Read more >WireMock Tutorial: Request Matching, Part Three
The previous part of my WireMock tutorial introduces several factory methods that help you to create new StringValuePattern objects.
Read more >aws_lb_listener_rule | Resources | hashicorp/aws
A listener can't have multiple rules with the same priority. ... (Optional) Information for creating an action that returns a custom HTTP response....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there any particular reason why StringValuePattern cannot be extensible or is it just the design decision? I think that some people may benefit from this option and it won’t hurt anybody in the process 😉
Is it possible to combine Custom Request Matcher with standard MappingBuilder? In fact using MappingBuilder covers 95% of my matching rules and additionaly I would like only to test one particular request header with my custom rules including some custom logic. If I would have to include all this standard matching rules in Custom Request Matcher it would be really a lot of unnecessary work.
Thanks!