alan0428a commented on code in PR #2691:
URL: https://github.com/apache/logging-log4j2/pull/2691#discussion_r1657071726


##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/pattern/ThrowableFilterTest.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.core.pattern;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.List;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.test.appender.ListAppender;
+import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
+import org.apache.logging.log4j.core.test.junit.Named;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Unit tests for {@code throwable} pattern.
+ */
+@LoggerContextSource("log4j-throwable-filter.xml")
+public class ThrowableFilterTest {

Review Comment:
   I agree creating test programmatically is pretty cool!
   And both approach seems good to me. Using `Configuration` approach we can 
build the converter in more like top-level `xml/yaml` way. Using `newInstance` 
is more like low-level API approach.
   I would prefer `Configuration` since it's more straight forward because I 
can create tests following the docs.
   But this is just my thought, I am not familiar with whole codebase 💦 



##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/StringBuildersTest.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.core.util;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.stream.Stream;
+import org.apache.logging.log4j.core.util.internal.StringBuilders;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+public class StringBuildersTest {
+
+    static Stream<Arguments> testTruncateLines_dataSource() {

Review Comment:
   @vy 
   Just found that `String.split(String regex)` is accepting regex, but 
`Collectors.joining(CharSequence delimeter)` is accepting pure string.
   So we need to provide `regex("\\|")` and `delimeter("|")` if we want to use 
   ```
   
Arrays.stream(input.split(delimiter)).limit(maxOccurrenceCount).collect(Collectors.joining(delimiter))
   ```
   Will it become too complicated? Also the joining will not append delimiter 
at the end.



-- 
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