Write logging in case a Matcher throws an exception (#986)

* ThrowException

* ...

* .

* ...

* b

* fix test

* ...

* .

* sonar

* ft

* .

* fix tst
This commit is contained in:
Stef Heyenrath
2023-08-21 20:07:46 +02:00
committed by GitHub
parent 09a302baf2
commit 93c87845c2
88 changed files with 1266 additions and 1244 deletions

View File

@@ -42,7 +42,7 @@ public class JmesPathMatcherTests
var matcher = new JmesPathMatcher("");
// Act
double match = matcher.IsMatch(bytes);
double match = matcher.IsMatch(bytes).Score;
// Assert
Check.That(match).IsEqualTo(0);
@@ -56,7 +56,7 @@ public class JmesPathMatcherTests
var matcher = new JmesPathMatcher("");
// Act
double match = matcher.IsMatch(s);
double match = matcher.IsMatch(s).Score;
// Assert
Check.That(match).IsEqualTo(0);
@@ -70,7 +70,7 @@ public class JmesPathMatcherTests
var matcher = new JmesPathMatcher("");
// Act
double match = matcher.IsMatch(o);
double match = matcher.IsMatch(o).Score;
// Assert
Check.That(match).IsEqualTo(0);
@@ -83,7 +83,7 @@ public class JmesPathMatcherTests
var matcher = new JmesPathMatcher("xxx");
// Act
double match = matcher.IsMatch("");
double match = matcher.IsMatch("").Score;
// Assert
Check.That(match).IsEqualTo(0);
@@ -96,7 +96,7 @@ public class JmesPathMatcherTests
var matcher = new JmesPathMatcher("");
// Act
double match = matcher.IsMatch("x");
double match = matcher.IsMatch("x").Score;
// Assert
Check.That(match).IsEqualTo(0);
@@ -109,7 +109,7 @@ public class JmesPathMatcherTests
var matcher = new JmesPathMatcher("things.name == 'RequiredThing'");
// Act
double match = matcher.IsMatch(new { things = new { name = "RequiredThing" } });
double match = matcher.IsMatch(new { things = new { name = "RequiredThing" } }).Score;
// Assert
Check.That(match).IsEqualTo(1);
@@ -132,7 +132,7 @@ public class JmesPathMatcherTests
{ "Id", new JValue(1) },
{ "things", sub }
};
double match = matcher.IsMatch(jobject);
double match = matcher.IsMatch(jobject).Score;
// Assert
Check.That(match).IsEqualTo(1);
@@ -145,7 +145,7 @@ public class JmesPathMatcherTests
var matcher = new JmesPathMatcher("things.x == 'RequiredThing'");
// Act
double match = matcher.IsMatch(JObject.Parse("{ \"things\": { \"x\": \"RequiredThing\" } }"));
double match = matcher.IsMatch(JObject.Parse("{ \"things\": { \"x\": \"RequiredThing\" } }")).Score;
// Assert
Check.That(match).IsEqualTo(1);
@@ -155,10 +155,10 @@ public class JmesPathMatcherTests
public void JmesPathMatcher_IsMatch_RejectOnMatch()
{
// Assign
var matcher = new JmesPathMatcher(MatchBehaviour.RejectOnMatch, false, MatchOperator.Or, "things.x == 'RequiredThing'");
var matcher = new JmesPathMatcher(MatchBehaviour.RejectOnMatch, MatchOperator.Or, "things.x == 'RequiredThing'");
// Act
double match = matcher.IsMatch(JObject.Parse("{ \"things\": { \"x\": \"RequiredThing\" } }"));
double match = matcher.IsMatch(JObject.Parse("{ \"things\": { \"x\": \"RequiredThing\" } }")).Score;
// Assert
Check.That(match).IsEqualTo(0.0);