Path: redb-route/tests/redb.Route.Tests/Expressions/PathSpellingTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests/Expressions/PathSpellingTests.cs ---- using AwesomeAssertions; using redb.Route.Core; using redb.Route.Expressions; namespace redb.Route.Tests.Expressions; /// /// Apache Camel's ${jsonpath:...} and ${xpath:...} (findings register row 34 point 2): spellings of /// jpath('...') and xpath('...') as a whole placeholder. Until 4.7.0 they rendered empty. /// public sealed class PathSpellingTests { private static Exchange Json() => new(new Message("""{"order":{"id":"A-1","amount":12.5,"items":["a","b"]}}""")); private static Exchange Xml() => new(new Message("A-1ab")); [Theory] [InlineData("${jsonpath:$.order.id}", "A-1")] [InlineData("${jsonpath: $.order.id }", "A-1")] [InlineData("id=${jsonpath:$.order.id}", "id=A-1")] public void Jsonpath_IsJpath(string template, string expected) { ExpressionResolver.ProcessTemplate(template, Json()).Should().Be(expected); ExpressionResolver.ProcessTemplate(template.Replace("jsonpath:$.order.id", "jpath('$.order.id')").Replace("jsonpath: $.order.id ", "jpath('$.order.id')"), Json()) .Should().Be(expected, "the spelling and the function agree"); } [Fact] public void Jsonpath_AWholePlaceholderKeepsTheValue_AndTakesAFormat() { new StringExpression("${jsonpath:$.order.amount}").Evaluate(Json()).Should() .Be(new StringExpression("${jpath('$.order.amount')}").Evaluate(Json())); ExpressionResolver.ProcessTemplate("${jsonpath:$.order.amount:F2}", Json()).Should().Be("12.50"); } [Fact] public void Xpath_IsXpath() { ExpressionResolver.ProcessTemplate("${xpath://order/id}", Xml()) .Should().Be(ExpressionResolver.ProcessTemplate("${xpath('//order/id')}", Xml())); ExpressionResolver.ProcessTemplate("id=${xpath://order/id/text()}", Xml()).Should().StartWith("id=A-1"); } [Theory] [InlineData("${jsonpath:}")] [InlineData("${xpath: }")] public void ASpellingWithoutAPath_IsAnError(string template) { var act = () => ExpressionResolver.ProcessTemplate(template, Json()); act.Should().Throw().WithMessage("*names no path*"); } }