gnodet-bot commented on code in PR #13643:
URL: https://github.com/apache/maven/pull/13643#discussion_r4321889810
##########
impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultInterpolatorTest.java:
##########
@@ -81,6 +81,41 @@ void testSubstLoop() {
"Expected substVars() to throw an InterpolatorException, but
it didn't");
}
+ @Test
+ void testSelfReferencingConfigPropertyDifferentCurrentKey() {
+ InterpolatorException ex = assertThrows(
+ InterpolatorException.class,
+ () -> substVars("${a}", "outer", Map.of("a", "${a}")),
+ "Expected substVars() to throw an InterpolatorException for
self-referencing property");
+ assertEquals("recursive variable reference: a", ex.getMessage());
Review Comment:
💡 **Nit:** The tests assert on the exact exception message string
`"recursive variable reference: a"`. If that message is ever reworded (e.g. for
better clarity or i18n), these four tests will all fail for the wrong reason.
Consider using `assertThat(ex.getMessage()).contains("a")` or simply not
asserting the message in the cycle-detection tests, since `assertThrows`
already confirms the right exception type is thrown.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]