Add JsonPartialWildcardMatcher (#667)

* JsonPartialWildcardMatcher

* .

* more tests
This commit is contained in:
Stef Heyenrath
2021-10-27 08:16:18 +02:00
committed by GitHub
parent 6f5eeb5359
commit 25666152bb
6 changed files with 575 additions and 74 deletions

View File

@@ -0,0 +1,38 @@
using JetBrains.Annotations;
namespace WireMock.Matchers
{
/// <summary>
/// JsonPartialWildCardMatcher
/// </summary>
public class JsonPartialWildcardMatcher : AbstractJsonPartialMatcher
{
/// <inheritdoc />
public override string Name => nameof(JsonPartialWildcardMatcher);
/// <inheritdoc />
public JsonPartialWildcardMatcher([NotNull] string value, bool ignoreCase = false, bool throwException = false)
: base(value, ignoreCase, throwException)
{
}
/// <inheritdoc />
public JsonPartialWildcardMatcher([NotNull] object value, bool ignoreCase = false, bool throwException = false)
: base(value, ignoreCase, throwException)
{
}
/// <inheritdoc />
public JsonPartialWildcardMatcher(MatchBehaviour matchBehaviour, [NotNull] object value, bool ignoreCase = false, bool throwException = false)
: base(matchBehaviour, value, ignoreCase, throwException)
{
}
/// <inheritdoc />
protected override bool IsMatch(string value, string input)
{
var wildcardStringMatcher = new WildcardMatcher(MatchBehaviour.AcceptOnMatch, value, IgnoreCase);
return MatchScores.IsPerfect(wildcardStringMatcher.IsMatch(input));
}
}
}