ppkarwasz commented on PR #3394:
URL: https://github.com/apache/logging-log4j2/pull/3394#issuecomment-2616618283

   > I have tried to fix the changes you have asked me and keep the pr as clean 
as possible however for the test cases I am not so sure because I lack 
knowledge about testing but if there are anymore further changes please let me 
know.
   
   For testing we have a JUnit 5 extension to create a new logger context (and 
configuration) for each test case. See for example:
   
   
https://github.com/apache/logging-log4j2/blob/fce6ce9bd4a8ecb7a70229e0d6182e296b9b86b7/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/ScriptAppenderSelectorTest.java#L42-L60
   
   On line 43 we use the `@LoggerContextSource` annotation to point to a 
configuration file on the classpath. To test that your PR solves #3336, you 
just need to create a configuration file that uses `ScriptRef` elements 
everywhere possible, but the `Scripts` configuration element is at the end.
   
   On line 44 our extension automatically injects an instance of 
`Configuration` to your test case. You can then check the structure of the 
configuration to see if the script-related elements are there, e.g.:
   
   ```java
   
assertThat(configuration.getFilter()).isNotNull().isInstanceOf(ScriptFilter.class);
   ```


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