/*
 * 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.junit;

import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.status.StatusLogger;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

/**
 * JUnit {@link TestRule} for constructing a new LoggerContext using a specified configuration file.
 */
public class InitialLoggerContext implements TestRule {

    private final String configLocation;

    private LoggerContext context;

    public InitialLoggerContext(final String configLocation) {
        this.configLocation = configLocation;
    }

    @Override
    public Statement apply(final Statement base, final Description description) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                context = Configurator.initialize(
                        description.getDisplayName(),
                        description.getTestClass().getClassLoader(),
                        configLocation
                );
                try {
                    base.evaluate();
                } finally {
                    Configurator.shutdown(context);
                    StatusLogger.getLogger().reset();
                }
            }
        };
    }

    public LoggerContext getContext() {
        return context;
    }

    public Logger getLogger(final String name) {
        return context.getLogger(name);
    }

    public Configuration getConfiguration() {
        return context.getConfiguration();
    }

    public Appender getAppender(final String name) {
        return getConfiguration().getAppenders().get(name);
    }
}

@@ -1262,16 +1262,51 @@
 ement;%0A%0A
+import static org.junit.Assert.*;%0A%0A
 /**%0A * J
@@ -1925,36 +1925,32 @@
                 
-    
 description.getD
@@ -1959,28 +1959,24 @@
 playName(),%0A
-    
             
@@ -2024,28 +2024,24 @@
 ssLoader(),%0A
-    
             
@@ -2333,378 +2333,1515 @@
     
-public LoggerContext getContext() %7B%0A        return context;%0A    %7D%0A%0A    public Logger getLogger(final String name) %7B%0A        return context.getLogger(name);%0A    %7D%0A%0A    public Configuration getConfiguration() %7B%0A        return context.getConfiguration();%0A    %7D%0A%0A    public Appender getAppender(final String name) %7B%0A        return getConfiguration().getAppenders().get(name)
+/**%0A     * Gets the current LoggerContext associated with this rule.%0A     * @return the current LoggerContext.%0A     */%0A    public LoggerContext getContext() %7B%0A        return context;%0A    %7D%0A%0A    /**%0A     * Gets a named Logger in this LoggerContext.%0A     *%0A     * @param name the name of the Logger to look up or create.%0A     * @return the named Logger.%0A     */%0A    public Logger getLogger(final String name) %7B%0A        return context.getLogger(name);%0A    %7D%0A%0A    /**%0A     * Gets the associated Configuration for the configuration file this was constructed with.%0A     * @return this LoggerContext's Configuration.%0A     */%0A    public Configuration getConfiguration() %7B%0A        return context.getConfiguration();%0A    %7D%0A%0A    /**%0A     * Gets a named Appender for this LoggerContext.%0A     * @param name the name of the Appender to look up.%0A     * @return the named Appender or %7B@code null%7D if it wasn't defined in the configuration.%0A     */%0A    public Appender getAppender(final String name) %7B%0A        return getConfiguration().getAppenders().get(name);%0A    %7D%0A%0A    /**%0A     * Gets a named Appender or throws an exception for this LoggerContext.%0A     * @param name the name of the Appender to look up.%0A     * @return the named Appender.%0A     * @throws AssertionError if the Appender doesn't exist.%0A     */%0A    public Appender getRequiredAppender(final String name) %7B%0A        final Appender appender = getAppender(name);%0A        assertNotNull(%22Appender named %22 + name + %22 was null.%22, appender);%0A        return appender
 ;%0A  

Add javadocs and getRequiredAppender method.