// Path: core/src/main/java/eu/drus/jpa/unit/spi/DecoratorExecutor.java
// public class DecoratorExecutor {
// 
//     private static final Comparator<TestDecorator> BEFORE_COMPARATOR = (a, b) -> a.getPriority() - b.getPriority();
//     private static final Comparator<TestDecorator> AFTER_COMPARATOR = (a, b) -> b.getPriority() - a.getPriority();
// 
//     public void processBeforeAll(final TestInvocation invocation) throws Exception {
//         final Iterator<TestClassDecorator> it = classDecoratorIterator(invocation.getContext(), BEFORE_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().beforeAll(invocation);
//         }
//     }
// 
//     public void processAfterAll(final TestInvocation invocation) throws Exception {
//         final Iterator<TestClassDecorator> it = classDecoratorIterator(invocation.getContext(), AFTER_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().afterAll(invocation);
//         }
//     }
// 
//     public void processBefore(final TestInvocation invocation) throws Exception {
//         final Iterator<TestMethodDecorator> it = methodDecoratorIterator(invocation.getContext(), BEFORE_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().beforeTest(invocation);
//         }
//     }
// 
//     public void processAfter(final TestInvocation invocation) throws Exception {
//         final Iterator<TestMethodDecorator> it = methodDecoratorIterator(invocation.getContext(), AFTER_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().afterTest(invocation);
//         }
//     }
// 
//     private Iterator<TestClassDecorator> classDecoratorIterator(final ExecutionContext ctx, final Comparator<TestDecorator> comparator) {
//         return getClassDecorators().stream().filter(d -> d.isConfigurationSupported(ctx)).sorted(comparator).iterator();
//     }
// 
//     private Iterator<TestMethodDecorator> methodDecoratorIterator(final ExecutionContext ctx, final Comparator<TestDecorator> comparator) {
//         return getMethodDecorators().stream().filter(d -> d.isConfigurationSupported(ctx)).sorted(comparator).iterator();
//     }
// }
// 
// Path: core/src/main/java/eu/drus/jpa/unit/spi/ExecutionContext.java
// public interface ExecutionContext {
// 
//     Field getPersistenceField();
// 
//     PersistenceUnitDescriptor getDescriptor();
// 
//     void storeData(String key, Object value);
// 
//     Object getData(String key);
// }


import java.util.List;
import org.junit.rules.MethodRule;
import eu.drus.jpa.unit.spi.DecoratorExecutor;
import eu.drus.jpa.unit.spi.ExecutionContext;
package eu.drus.jpa.unit.rule;




public final class MethodRuleRegistrar {

    private MethodRuleRegistrar() {}

    public static List<MethodRule> registerRules(final List<MethodRule> rules, final DecoratorExecutor executor,
// Path: core/src/main/java/eu/drus/jpa/unit/spi/DecoratorExecutor.java
// public class DecoratorExecutor {
// 
//     private static final Comparator<TestDecorator> BEFORE_COMPARATOR = (a, b) -> a.getPriority() - b.getPriority();
//     private static final Comparator<TestDecorator> AFTER_COMPARATOR = (a, b) -> b.getPriority() - a.getPriority();
// 
//     public void processBeforeAll(final TestInvocation invocation) throws Exception {
//         final Iterator<TestClassDecorator> it = classDecoratorIterator(invocation.getContext(), BEFORE_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().beforeAll(invocation);
//         }
//     }
// 
//     public void processAfterAll(final TestInvocation invocation) throws Exception {
//         final Iterator<TestClassDecorator> it = classDecoratorIterator(invocation.getContext(), AFTER_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().afterAll(invocation);
//         }
//     }
// 
//     public void processBefore(final TestInvocation invocation) throws Exception {
//         final Iterator<TestMethodDecorator> it = methodDecoratorIterator(invocation.getContext(), BEFORE_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().beforeTest(invocation);
//         }
//     }
// 
//     public void processAfter(final TestInvocation invocation) throws Exception {
//         final Iterator<TestMethodDecorator> it = methodDecoratorIterator(invocation.getContext(), AFTER_COMPARATOR);
//         while (it.hasNext()) {
//             it.next().afterTest(invocation);
//         }
//     }
// 
//     private Iterator<TestClassDecorator> classDecoratorIterator(final ExecutionContext ctx, final Comparator<TestDecorator> comparator) {
//         return getClassDecorators().stream().filter(d -> d.isConfigurationSupported(ctx)).sorted(comparator).iterator();
//     }
// 
//     private Iterator<TestMethodDecorator> methodDecoratorIterator(final ExecutionContext ctx, final Comparator<TestDecorator> comparator) {
//         return getMethodDecorators().stream().filter(d -> d.isConfigurationSupported(ctx)).sorted(comparator).iterator();
//     }
// }
// 
// Path: core/src/main/java/eu/drus/jpa/unit/spi/ExecutionContext.java
// public interface ExecutionContext {
// 
//     Field getPersistenceField();
// 
//     PersistenceUnitDescriptor getDescriptor();
// 
//     void storeData(String key, Object value);
// 
//     Object getData(String key);
// }


// Path: junit4-extension/src/main/java/eu/drus/jpa/unit/rule/MethodRuleRegistrar.java
import java.util.List;
import org.junit.rules.MethodRule;
import eu.drus.jpa.unit.spi.DecoratorExecutor;
import eu.drus.jpa.unit.spi.ExecutionContext;

package eu.drus.jpa.unit.rule;




public final class MethodRuleRegistrar {

    private MethodRuleRegistrar() {}

    public static List<MethodRule> registerRules(final List<MethodRule> rules, final DecoratorExecutor executor,
            final ExecutionContext ctx) {