rpuch commented on code in PR #2429:
URL: https://github.com/apache/ignite-3/pull/2429#discussion_r1299870608


##########
modules/core/src/testFixtures/java/org/apache/ignite/internal/testframework/log4j2/TestLogChecker.java:
##########
@@ -35,7 +35,51 @@
 import org.apache.logging.log4j.core.config.Property;
 
 /**
- * Test log checker.
+ * This class is used to check log events/messages.
+ * <p>
+ * When it is needed to check log events/messages, the following steps should 
be performed:
+ * </p>
+ * <pre><code>
+ *     // Create a new instance of TestLogChecker for the given logger name 
and specified predicate.
+ *     TestLogChecker checker = new TestLogChecker(
+ *             CustomClass.class.getName(),
+ *             evt -> evt.getMessage().getFormattedMessage().matches(pattern) 
&& evt.getLevel() == Level.ERROR);
+ *
+ *     checker.start();
+ *     try {
+ *         // do something
+ *     } finally {
+ *         checker.stop();
+ *     }
+ *
+ *     assertThat(checker.isMatched(), is(true));
+ * </code></pre>
+ * <p>
+ * When it is needed to check log events/messages and perform some action, 
just add a predicate and an action:
+ * </p>
+ * <pre><code>
+ *     AtomicInteger messageCounter = new AtomicInteger();
+ *     TestLogChecker checker = new TestLogChecker(
+ *             CustomClass.class.getName(),
+ *             evt -> evt.getMessage().getFormattedMessage().matches(pattern) 
&& evt.getLevel() == Level.ERROR,
+ *             // This action will be executed when the predicate is matched.
+ *             () -> {
+ *                 messageCounter.incrementAndGet();
+ *             });
+ *
+ *     checker.start();
+ *     try {
+ *         // do something
+ *     } finally {
+ *         checker.stop();
+ *     }
+ *
+ *     assertThat(messageCounter.get(), is(42));
+ * </code></pre>
+ * <p>
+ * It is possible to add a new pair of of predicate and action using {@link 
#addHandler(Predicate, Runnable)},

Review Comment:
   ```suggestion
    * It is possible to add a new pair of predicate and action using {@link 
#addHandler(Predicate, Runnable)},
   ```



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

Reply via email to