3232import org .apache .logging .log4j .core .util .CronExpression ;
3333import org .apache .logging .log4j .plugins .Named ;
3434import org .apache .logging .log4j .test .junit .TempLoggingDir ;
35- import org .junit .jupiter .api .BeforeEach ;
35+ import org .junit .jupiter .api .AfterAll ;
36+ import org .junit .jupiter .api .BeforeAll ;
3637import org .junit .jupiter .api .Test ;
3738import org .opentest4j .TestAbortedException ;
3839
@@ -42,8 +43,10 @@ class RollingAppenderCronTest extends AbstractRollingListenerTest {
4243
4344 static {
4445 try {
45- CONFIG = Path .of (requireNonNull (RollingAppenderCronTest .class .getResource ("RollingAppenderCronTest.xml" ))
46- .toURI ());
46+ final Path config =
47+ Path .of (requireNonNull (RollingAppenderCronTest .class .getResource ("RollingAppenderCronTest.old.xml" ))
48+ .toURI ());
49+ CONFIG = config .resolveSibling ("RollingAppenderCronTest.xml" );
4750 } catch (final URISyntaxException e ) {
4851 throw new TestAbortedException ("Unable to compute configuration location." , e );
4952 }
@@ -55,14 +58,19 @@ class RollingAppenderCronTest extends AbstractRollingListenerTest {
5558 @ TempLoggingDir
5659 private static Path loggingPath ;
5760
58- @ BeforeEach
59- void beforeEach () throws Exception {
61+ @ BeforeAll
62+ static void beforeEach () throws Exception {
6063 final Path src =
6164 Path .of (requireNonNull (RollingAppenderCronTest .class .getResource ("RollingAppenderCronTest.old.xml" ))
6265 .toURI ());
6366 Files .copy (src , CONFIG , REPLACE_EXISTING );
6467 }
6568
69+ @ AfterAll
70+ static void cleanUp () throws Exception {
71+ Files .deleteIfExists (CONFIG );
72+ }
73+
6674 @ Test
6775 @ LoggerContextSource (timeout = 10 )
6876 public void testAppender (final LoggerContext context , @ Named ("RollingFile" ) final RollingFileManager manager )
0 commit comments