Description
The integration tests that specify a custom log4j2.xml use the following pattern. I'd like to create a JUnit rule that does all of this without having to set up a @ClassRule and @BeforeClass just to copy a log4j2.xml to a TemporaryFolder to feed to LoggerContextRule.
@ClassRule public static TemporaryFolder temporaryFolder = new TemporaryFolder(); @Rule public LoggerContextRule loggerContextRule = new LoggerContextRule(configFilePath); @BeforeClass public static void setUpLogConfigFile() throws Exception { URL resource = getResource(CONFIG_FILE_NAME); configFilePath = createFileFromResource(resource, temporaryFolder.getRoot(), CONFIG_FILE_NAME) .getAbsolutePath(); }