ppkarwasz commented on code in PR #2393:
URL: https://github.com/apache/logging-log4j2/pull/2393#discussion_r1533621077


##########
log4j-api-test/src/test/java/org/apache/logging/log4j/message/ParameterFormatterTest.java:
##########
@@ -68,15 +67,12 @@ void test_pattern_analysis(
         }
     }
 
-    @ParameterizedTest
-    @CsvSource({"1,foo {}", "2,bar {}{}"})
-    void format_should_fail_on_insufficient_args(final int placeholderCount, 
final String pattern) {
-        final int argCount = placeholderCount - 1;
-        assertThatThrownBy(() -> ParameterFormatter.format(pattern, new 
Object[argCount], argCount))
-                .isInstanceOf(IllegalArgumentException.class)
-                .hasMessage(
-                        "found %d argument placeholders, but provided %d for 
pattern `%s`",
-                        placeholderCount, argCount, pattern);

Review Comment:
   While we don't provide an equivalent `assertThatLoggedBy` method to test 
that a certain status logger message was issued (we probably should), you can 
add an `org.apache.logging.log4j.Logger statusLogger` parameter to 
`ParameterFormatter.format` and detect status messages as in 
[`ProviderUtilTest`](https://github.com/apache/logging-log4j2/blob/ed4c72e679951fe78fe4121436085444bc87b388/log4j-api-test/src/test/java/org/apache/logging/log4j/util/ProviderUtilTest.java).



-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to