// 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/TestInvocation.java
// public interface TestInvocation {
// 
//     Class<?> getTestClass();
// 
//     ExecutionContext getContext();
// 
//     Optional<Method> getTestMethod();
// 
//     Optional<Object> getTestInstance();
// 
//     Optional<Throwable> getException();
// 
//     FeatureResolver getFeatureResolver();
// }


import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.notNull;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import cucumber.api.java.en.Then;
import cucumber.api.java.ru.Если;
import eu.drus.jpa.unit.core.JpaUnitContext;
import eu.drus.jpa.unit.spi.DecoratorExecutor;
import eu.drus.jpa.unit.spi.TestInvocation;
        // THEN
        verifyZeroInteractions(executor);
    }

    @Test
    public void testGetInstanceForSameTypeAlwaysReturnsSameObject() {
        // GIVEN

        // WHEN
        final ClassA obj1 = factory.getInstance(ClassA.class);
        final ClassA obj2 = factory.getInstance(ClassA.class);

        // THEN
        assertNotNull(obj1);
        assertNotNull(obj2);
        assertThat(obj1, equalTo(obj2));
    }

    @Test
    public void testGetInstanceForSameTypeLeadsToExecutionOfProcessBeforeAllOnlyOnce() throws Exception {
        // GIVEN

        // WHEN
        final ClassA obj1 = factory.getInstance(ClassA.class);
        final ClassA obj2 = factory.getInstance(ClassA.class);

        // THEN
        assertNotNull(obj1);
        assertNotNull(obj2);

// 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/TestInvocation.java
// public interface TestInvocation {
// 
//     Class<?> getTestClass();
// 
//     ExecutionContext getContext();
// 
//     Optional<Method> getTestMethod();
// 
//     Optional<Object> getTestInstance();
// 
//     Optional<Throwable> getException();
// 
//     FeatureResolver getFeatureResolver();
// }


// Path: cucumber/src/test/java/cucumber/runtime/java/jpa/unit/JpaUnitObjectFactoryTest.java
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.notNull;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import cucumber.api.java.en.Then;
import cucumber.api.java.ru.Если;
import eu.drus.jpa.unit.core.JpaUnitContext;
import eu.drus.jpa.unit.spi.DecoratorExecutor;
import eu.drus.jpa.unit.spi.TestInvocation;

        // THEN
        verifyZeroInteractions(executor);
    }

    @Test
    public void testGetInstanceForSameTypeAlwaysReturnsSameObject() {
        // GIVEN

        // WHEN
        final ClassA obj1 = factory.getInstance(ClassA.class);
        final ClassA obj2 = factory.getInstance(ClassA.class);

        // THEN
        assertNotNull(obj1);
        assertNotNull(obj2);
        assertThat(obj1, equalTo(obj2));
    }

    @Test
    public void testGetInstanceForSameTypeLeadsToExecutionOfProcessBeforeAllOnlyOnce() throws Exception {
        // GIVEN

        // WHEN
        final ClassA obj1 = factory.getInstance(ClassA.class);
        final ClassA obj2 = factory.getInstance(ClassA.class);

        // THEN
        assertNotNull(obj1);
        assertNotNull(obj2);

        final ArgumentCaptor<TestInvocation> invocationCaptor = ArgumentCaptor.forClass(TestInvocation.class);