I’m using MockServer body matchers to verify an endpoint request’s body parameters. Some properties can be matched exactly, but others may need a separate subString or regex matcher, because part of that property is unknown. For example, a date-time string may have a known date, but unknown time. …
Tag: matcher
Java PathMatcher not working properly on Windows
I try to implement a JUnit test for my SimpleFileVisitor but the used PathMatcher doesn’t work properly on Windows. The problem seems to be the PathMatcher with a regex pattern behaves different on Linux and Windows: But I’ve a longer list in my regex for multiple files which are not easy to migra…
When to use ** (double star) in glob syntax within JAVA
Directly from this Java Oracle tutorial: Two asterisks, **, works like * but crosses directory boundaries. This syntax is generally used for matching complete paths. Could anybody do a real example out of it? What do they mean with “crosses directory boundary”? Crossing the directory boundary, I i…
Use variables in pattern matcher
I have the following: But would like to replace the {6,20} with variable values due to them been dynamic in some cases. I.e. How can I include variables in the Reg Exp? Thanks Answer Use Java’s simple string concatenation, using the plus sign. Indeed, as Michael suggested compiling it is better for perf…