Skip to content
Advertisement

Tag: matcher

MockServer verify with multiple body matchers

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. However, with multiple withBody() calls, the verify method passes if one or

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 migrate to glob syntax. Otherwise I’ve nested groups

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 imagine something like checking the file from root to getNameCount()-1. Again a real

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 performance if you use it a lot. Then

Advertisement