From f49d834ffb5c146d9ae6eee0d6f341fe50cf58ab Mon Sep 17 00:00:00 2001 From: CEL Dev Team Date: Mon, 16 Jun 2025 16:37:22 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 772218576 --- .../dev/cel/testing/testrunner/DefaultResultMatcher.java | 3 ++- .../cel/testing/testrunner/DefaultResultMatcherTest.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/testing/src/main/java/dev/cel/testing/testrunner/DefaultResultMatcher.java b/testing/src/main/java/dev/cel/testing/testrunner/DefaultResultMatcher.java index e332bc31c..8e3424cab 100644 --- a/testing/src/main/java/dev/cel/testing/testrunner/DefaultResultMatcher.java +++ b/testing/src/main/java/dev/cel/testing/testrunner/DefaultResultMatcher.java @@ -15,6 +15,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat; +import static com.google.protobuf.LegacyUnredactedTextFormat.legacyUnredactedStringValueOf; import static dev.cel.testing.utils.ExprValueUtils.toExprValue; import dev.cel.expr.ExprValue; @@ -69,7 +70,7 @@ public void match(ResultMatcherParams params, Cel cel) throws Exception { if (params.computedOutput().kind().equals(ComputedOutput.Kind.EXPR_VALUE)) { throw new AssertionError( "Evaluation was successful but no value was provided. Computed output: " - + params.computedOutput().exprValue()); + + legacyUnredactedStringValueOf(params.computedOutput().exprValue())); } assertThat(params.computedOutput().error().toString()) .contains(result.evalError().get(0).toString()); diff --git a/testing/src/test/java/dev/cel/testing/testrunner/DefaultResultMatcherTest.java b/testing/src/test/java/dev/cel/testing/testrunner/DefaultResultMatcherTest.java index 640320168..41677c16c 100644 --- a/testing/src/test/java/dev/cel/testing/testrunner/DefaultResultMatcherTest.java +++ b/testing/src/test/java/dev/cel/testing/testrunner/DefaultResultMatcherTest.java @@ -123,7 +123,9 @@ public void match_expectedEvalErrorAndComputedExprValue_failure() throws Excepti assertThat(thrown) .hasMessageThat() - .contains("Evaluation was successful but no value was provided. Computed output:"); - assertThat(thrown).hasMessageThat().contains("value {\n int64_value: 3\n}"); + .contains( + "Evaluation was successful but no value was provided. Computed output: value {\n" + + " int64_value: 3\n" + + "}"); } }