// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/fixture/FixtureListener.java
// public interface FixtureListener {
//     void beforeExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger);
// 
//     void afterExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger);
// 
//     void beforeSpecification(Class<? extends ConcordionBase> aClass, Logger logger);
// 
//     void afterSpecification(Class<? extends ConcordionBase> aClass, Logger logger);
// 
//     void beforeSuite(Class<? extends ConcordionBase> aClass, Logger logger);
// 
//     void afterSuite(Class<? extends ConcordionBase> aClass, Logger logger);
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/fixture/FixtureLogger.java
// public class FixtureLogger implements FixtureListener {
//     @Override
//     public void beforeExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger) {
//     }
// 
//     @Override
//     public void afterExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger) {
//     }
// 
//     @Override
//     public void beforeSpecification(Class<? extends ConcordionBase> aClass, Logger logger) {
//     }
// 
//     @Override
//     public void afterSpecification(Class<? extends ConcordionBase> aClass, Logger logger) {
//         logger.info("Tearing down the acceptance test class {} on thread {}",
//                 aClass.getSimpleName(), Thread.currentThread().getName());
//     }
// 
//     @Override
//     public void beforeSuite(Class<? extends ConcordionBase> aClass, Logger logger) {
//     }
// 
//     @Override
//     public void afterSuite(Class<? extends ConcordionBase> aClass, Logger logger) {
//         logger.info("Tearing down the test suite (called from test class {} on thread {}). ",
//                 aClass.getSimpleName(), Thread.currentThread().getName());
//     }
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/resource/CloseListener.java
// public interface CloseListener {
//     default void beforeClosing(Closeable resource) {};
//     default void afterClosing(Closeable resource) {};
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/resource/ResourceRegistry.java
// public interface ResourceRegistry {
//     /**
//      * Automatically close the <code>resource</code> at the end of the specified <code>scope</code>.
//      */
//     void registerCloseableResource(Closeable resource, ResourceScope scope);
// 
//     /**
//      * Automatically close the <code>resource</code> at the end of the specified <code>scope</code>. Call the
//      * relevant methods on <code>listener</code> before and after closing the resource.
//      */
//     void registerCloseableResource(Closeable resource, ResourceScope scope, CloseListener listener);
// 
//     /**
//      * Ascertains whether the <code>resource</code> is registered at the specified <code>scope</code>.
//      */
//     boolean isRegistered(Closeable resource, ResourceScope scope);
// 
//     /**
//      * Close and deregister the specified <code>resource</code> from all scopes.
//      */
//     void closeResource(Closeable resource);
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/resource/ResourceScope.java
// public enum ResourceScope {
//     /**
//      * Per Concordion Specification Example
//      */
//     EXAMPLE,
//     /**
//      * Per Concordion Specification
//      */
//     SPECIFICATION,
//     /**
//      * Per Concordion Suite, where a Suite equates to the top-level test that is invoked (normally using JUnit).
//      * Other tests that are invoked from the top-level test using the Run Command are part of the suite.
//      * Other tests invoked directly (from JUnit) form independent suites.
//      */
//     SUITE;
// }


import org.apache.commons.lang3.tuple.ImmutablePair;
import org.concordion.api.*;
import org.concordion.api.option.ConcordionOptions;
import org.concordion.api.option.MarkdownExtensions;
import org.concordion.cubano.framework.fixture.FixtureListener;
import org.concordion.cubano.framework.fixture.FixtureLogger;
import org.concordion.cubano.framework.resource.CloseListener;
import org.concordion.cubano.framework.resource.ResourceRegistry;
import org.concordion.cubano.framework.resource.ResourceScope;
import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.EnumSet;
import java.util.Optional;
import java.util.concurrent.ConcurrentLinkedDeque;
package org.concordion.cubano.framework;



/**
 * Basic Concordion Fixture for inheritance by index fixtures with no tests.
 * <p>
 * Supports the automatic closing of {@link Closeable} resources at either the {@link ResourceScope#SPECIFICATION}
 * or {@link ResourceScope#SUITE} level. After calling {@link #registerCloseableResource(Closeable, ResourceScope)}
 * , the resource will automatically be closed at the end of the specified scope.
 * Resources will be closed in the reverse order to which they were registered.
 * </p>
 * The resource registry is thread-safe for SUITE scoped resources. It is not thread-safe for EXAMPLE and SPECIFICATION
 * scoped resources which rely on Concordion creating a new instance for each test.
 **/
@RunWith(ConcordionRunner.class)
@ConcordionOptions(markdownExtensions = {MarkdownExtensions.HARDWRAPS, MarkdownExtensions.AUTOLINKS})
public abstract class ConcordionBase implements ResourceRegistry {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    protected FixtureListener fixtureListener = new FixtureLogger();

// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/fixture/FixtureListener.java
// public interface FixtureListener {
//     void beforeExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger);
// 
//     void afterExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger);
// 
//     void beforeSpecification(Class<? extends ConcordionBase> aClass, Logger logger);
// 
//     void afterSpecification(Class<? extends ConcordionBase> aClass, Logger logger);
// 
//     void beforeSuite(Class<? extends ConcordionBase> aClass, Logger logger);
// 
//     void afterSuite(Class<? extends ConcordionBase> aClass, Logger logger);
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/fixture/FixtureLogger.java
// public class FixtureLogger implements FixtureListener {
//     @Override
//     public void beforeExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger) {
//     }
// 
//     @Override
//     public void afterExample(Class<? extends ConcordionBase> aClass, String exampleName, Logger logger) {
//     }
// 
//     @Override
//     public void beforeSpecification(Class<? extends ConcordionBase> aClass, Logger logger) {
//     }
// 
//     @Override
//     public void afterSpecification(Class<? extends ConcordionBase> aClass, Logger logger) {
//         logger.info("Tearing down the acceptance test class {} on thread {}",
//                 aClass.getSimpleName(), Thread.currentThread().getName());
//     }
// 
//     @Override
//     public void beforeSuite(Class<? extends ConcordionBase> aClass, Logger logger) {
//     }
// 
//     @Override
//     public void afterSuite(Class<? extends ConcordionBase> aClass, Logger logger) {
//         logger.info("Tearing down the test suite (called from test class {} on thread {}). ",
//                 aClass.getSimpleName(), Thread.currentThread().getName());
//     }
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/resource/CloseListener.java
// public interface CloseListener {
//     default void beforeClosing(Closeable resource) {};
//     default void afterClosing(Closeable resource) {};
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/resource/ResourceRegistry.java
// public interface ResourceRegistry {
//     /**
//      * Automatically close the <code>resource</code> at the end of the specified <code>scope</code>.
//      */
//     void registerCloseableResource(Closeable resource, ResourceScope scope);
// 
//     /**
//      * Automatically close the <code>resource</code> at the end of the specified <code>scope</code>. Call the
//      * relevant methods on <code>listener</code> before and after closing the resource.
//      */
//     void registerCloseableResource(Closeable resource, ResourceScope scope, CloseListener listener);
// 
//     /**
//      * Ascertains whether the <code>resource</code> is registered at the specified <code>scope</code>.
//      */
//     boolean isRegistered(Closeable resource, ResourceScope scope);
// 
//     /**
//      * Close and deregister the specified <code>resource</code> from all scopes.
//      */
//     void closeResource(Closeable resource);
// }
// 
// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/resource/ResourceScope.java
// public enum ResourceScope {
//     /**
//      * Per Concordion Specification Example
//      */
//     EXAMPLE,
//     /**
//      * Per Concordion Specification
//      */
//     SPECIFICATION,
//     /**
//      * Per Concordion Suite, where a Suite equates to the top-level test that is invoked (normally using JUnit).
//      * Other tests that are invoked from the top-level test using the Run Command are part of the suite.
//      * Other tests invoked directly (from JUnit) form independent suites.
//      */
//     SUITE;
// }


// Path: cubano-concordion/src/main/java/org/concordion/cubano/framework/ConcordionBase.java
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.concordion.api.*;
import org.concordion.api.option.ConcordionOptions;
import org.concordion.api.option.MarkdownExtensions;
import org.concordion.cubano.framework.fixture.FixtureListener;
import org.concordion.cubano.framework.fixture.FixtureLogger;
import org.concordion.cubano.framework.resource.CloseListener;
import org.concordion.cubano.framework.resource.ResourceRegistry;
import org.concordion.cubano.framework.resource.ResourceScope;
import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.EnumSet;
import java.util.Optional;
import java.util.concurrent.ConcurrentLinkedDeque;

package org.concordion.cubano.framework;



/**
 * Basic Concordion Fixture for inheritance by index fixtures with no tests.
 * <p>
 * Supports the automatic closing of {@link Closeable} resources at either the {@link ResourceScope#SPECIFICATION}
 * or {@link ResourceScope#SUITE} level. After calling {@link #registerCloseableResource(Closeable, ResourceScope)}
 * , the resource will automatically be closed at the end of the specified scope.
 * Resources will be closed in the reverse order to which they were registered.
 * </p>
 * The resource registry is thread-safe for SUITE scoped resources. It is not thread-safe for EXAMPLE and SPECIFICATION
 * scoped resources which rely on Concordion creating a new instance for each test.
 **/
@RunWith(ConcordionRunner.class)
@ConcordionOptions(markdownExtensions = {MarkdownExtensions.HARDWRAPS, MarkdownExtensions.AUTOLINKS})
public abstract class ConcordionBase implements ResourceRegistry {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    protected FixtureListener fixtureListener = new FixtureLogger();

    private final Deque<ImmutablePair<Closeable, CloseListener>> examplePairs = new ArrayDeque<>();