Skip to content

Commit 9ac8f95

Browse files
committed
resolve comments
1 parent bd4cb56 commit 9ac8f95

2 files changed

Lines changed: 15 additions & 21 deletions

File tree

xds/src/test/java/io/grpc/xds/internal/matcher/CelEnvironmentTest.java

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -262,32 +262,26 @@ public void celEnvironment_runtime_disabledFeatures_throwsException() throws Exc
262262
// String concatenation fails at runtime evaluation (missing overload)
263263
CelAbstractSyntaxTree stringConcatAst = compileLenientAst("'a' + 'b'");
264264
CelRuntime.Program stringConcatProgram = CelCommon.RUNTIME.createProgram(stringConcatAst);
265-
try {
266-
stringConcatProgram.eval(resolver);
267-
Assert.fail("String concatenation evaluation should fail");
268-
} catch (CelEvaluationException e) {
269-
assertThat(e).hasMessageThat().contains("No matching overload");
270-
}
265+
Assert.assertThrows(
266+
"String concatenation evaluation should fail",
267+
CelEvaluationException.class,
268+
() -> stringConcatProgram.eval(resolver));
271269

272-
// List concatenation fails at runtime evaluation (missing overload)
270+
// List concatenation fails at runtime evaluation
273271
CelAbstractSyntaxTree listConcatAst = compileLenientAst("[1] + [2]");
274272
CelRuntime.Program listConcatProgram = CelCommon.RUNTIME.createProgram(listConcatAst);
275-
try {
276-
listConcatProgram.eval(resolver);
277-
Assert.fail("List concatenation evaluation should fail");
278-
} catch (CelEvaluationException e) {
279-
assertThat(e).hasMessageThat().contains("No matching overload");
280-
}
273+
Assert.assertThrows(
274+
"List concatenation evaluation should fail",
275+
CelEvaluationException.class,
276+
() -> listConcatProgram.eval(resolver));
281277

282-
// String conversion fails at runtime evaluation (missing overload/function)
278+
// String conversion fails at runtime evaluation
283279
CelAbstractSyntaxTree stringConvAst = compileLenientAst("string(1)");
284280
CelRuntime.Program stringConvProgram = CelCommon.RUNTIME.createProgram(stringConvAst);
285-
try {
286-
stringConvProgram.eval(resolver);
287-
Assert.fail("String conversion evaluation should fail");
288-
} catch (CelEvaluationException e) {
289-
assertThat(e).hasMessageThat().contains("No matching overload");
290-
}
281+
Assert.assertThrows(
282+
"String conversion evaluation should fail",
283+
CelEvaluationException.class,
284+
() -> stringConvProgram.eval(resolver));
291285
}
292286

293287
@Test

xds/src/test/java/io/grpc/xds/internal/matcher/CelStringExtractorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void compile_invalidSyntax_throws() {
153153
CelMatcherTestHelper.compileStringExtractor("invalid syntax ???");
154154
fail("Should throw CelValidationException");
155155
} catch (dev.cel.common.CelValidationException e) {
156-
assertThat(e).hasMessageThat().contains("mismatched input");
156+
assertThat(e).hasMessageThat().isNotEmpty();
157157
} catch (Exception e) {
158158
fail("Threw wrong exception type: " + e.getClass().getName());
159159
}

0 commit comments

Comments
 (0)