// Path: powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/extension/listener/AnnotationEnabler.java
// @SuppressWarnings("deprecation")
// public class AnnotationEnabler extends AbstractPowerMockTestListenerBase implements AnnotationEnablerListener {
// 
//     @Override
//     public void beforeTestMethod(Object testInstance, Method method, Object[] arguments) throws Exception {
//         standardInject(testInstance);
//         injectSpiesAndInjectToSetters(testInstance);
//         injectCaptor(testInstance);
//     }
// 
//     private void injectSpiesAndInjectToSetters(Object testInstance) {
//         new PowerMockitoInjectingAnnotationEngine().process(testInstance.getClass(), testInstance);
//     }
// 
//     private void injectCaptor(Object testInstance) throws Exception {
//         Set<Field> fieldsAnnotatedWithCaptor = Whitebox.getFieldsAnnotatedWith(testInstance, Captor.class);
//         for (Field field : fieldsAnnotatedWithCaptor) {
//             final Object captor = processAnnotationOn(field.getAnnotation(Captor.class), field);
//             field.set(testInstance, captor);
//         }
//     }
// 
//     private void standardInject(Object testInstance) throws IllegalAccessException {
//         Set<Field> fields = Whitebox.getFieldsAnnotatedWith(testInstance, getMockAnnotations());
//         for (Field field : fields) {
//             if (field.get(testInstance) != null) {
//                 continue;
//             }
//             final Class<?> type = field.getType();
// 
//             if (field.isAnnotationPresent(org.mockito.Mock.class)) {
//                 org.mockito.Mock mockAnnotation = field.getAnnotation(org.mockito.Mock.class);
//                 MockSettings mockSettings = withSettings();
//                 Answers answers = mockAnnotation.answer();
//                 if (answers != null) {
//                     mockSettings.defaultAnswer(answers);
//                 }
// 
//                 Class<?>[] extraInterfaces = mockAnnotation.extraInterfaces();
//                 if (extraInterfaces != null && extraInterfaces.length > 0) {
//                     mockSettings.extraInterfaces(extraInterfaces);
//                 }
// 
//                 String name = mockAnnotation.name();
//                 if (name != null && name.length() > 0) {
//                     mockSettings.name(name);
//                 }
// 
//                 field.set(testInstance, mock(type, mockSettings));
//             } else {
//                 field.set(testInstance, mock(type));
//             }
//         }
//     }
// 
//     @SuppressWarnings("unchecked")
//     @Override
//     public Class<? extends Annotation>[] getMockAnnotations() {
//         return new Class[]{org.mockito.Mock.class, Mock.class};
//     }
// 
//     private Object processAnnotationOn(Captor annotation, Field field) {
//         Class<?> type = field.getType();
//         if (!ArgumentCaptor.class.isAssignableFrom(type)) {
//             throw new MockitoException("@Captor field must be of the type ArgumentCaptor.\n" + "Field: '"
//                     + field.getName() + "' has wrong type\n"
//                     + "For info how to use @Captor annotations see examples in javadoc for MockitoAnnotations class.");
//         }
//         Class cls = new GenericMaster().getGenericType(field);
//         return ArgumentCaptor.forClass(cls);
//     }
// }
// 
// Path: powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/PowerMockRunner.java
// public class PowerMockRunner extends AbstractCommonPowerMockRunner {
// 
//     public PowerMockRunner(Class<?> klass) throws Exception {
//         super(klass, getRunnerDelegateImplClass(klass));
//     }
//     
//     private static Class<? extends PowerMockJUnitRunnerDelegate> getRunnerDelegateImplClass(Class<?> klass) {
//         if (klass.isAnnotationPresent(PowerMockRunnerDelegate.class)
//                 || Boolean.getBoolean("powermock.implicitDelegateAnnotation")) {
//             return DelegatingPowerMockRunner.class;
//         }
// 
//         Class<? extends PowerMockJUnitRunnerDelegate> concreteClass = PowerMockJUnit44RunnerDelegateImpl.class;
//         if(JUnitVersion.isGreaterThanOrEqualTo("4.9")) {
//                    concreteClass = PowerMockJUnit49RunnerDelegateImpl.class;
//         } else if( JUnitVersion.isGreaterThanOrEqualTo("4.7") ) {
//             concreteClass = PowerMockJUnit47RunnerDelegateImpl.class;
//         }
//         return concreteClass;
//     }
// 
//     /**
//      * Clean up some state to avoid OOM issues
//      */
//     @Override
//     public void run(RunNotifier notifier) {
//         Description description = getDescription();
//         try {
//             super.run(notifier);
//         } finally {
//             Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{});
//         }
//     }
// }


import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.annotation.Mock;
import org.powermock.api.extension.listener.AnnotationEnabler;
import org.powermock.core.classloader.annotations.PowerMockListener;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.easymock.EasyMock.expect;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.powermock.api.easymock.PowerMock.replayAll;
package samples.junit412.github668;




/**
 *
 */
@RunWith(PowerMockRunner.class)
@PowerMockListener(AnnotationEnabler.class)
public class TwoMockFieldsWithSameTypeCase {

    @Mock(fieldName = "incidentPropertyChangeDAO")
// Path: powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/extension/listener/AnnotationEnabler.java
// @SuppressWarnings("deprecation")
// public class AnnotationEnabler extends AbstractPowerMockTestListenerBase implements AnnotationEnablerListener {
// 
//     @Override
//     public void beforeTestMethod(Object testInstance, Method method, Object[] arguments) throws Exception {
//         standardInject(testInstance);
//         injectSpiesAndInjectToSetters(testInstance);
//         injectCaptor(testInstance);
//     }
// 
//     private void injectSpiesAndInjectToSetters(Object testInstance) {
//         new PowerMockitoInjectingAnnotationEngine().process(testInstance.getClass(), testInstance);
//     }
// 
//     private void injectCaptor(Object testInstance) throws Exception {
//         Set<Field> fieldsAnnotatedWithCaptor = Whitebox.getFieldsAnnotatedWith(testInstance, Captor.class);
//         for (Field field : fieldsAnnotatedWithCaptor) {
//             final Object captor = processAnnotationOn(field.getAnnotation(Captor.class), field);
//             field.set(testInstance, captor);
//         }
//     }
// 
//     private void standardInject(Object testInstance) throws IllegalAccessException {
//         Set<Field> fields = Whitebox.getFieldsAnnotatedWith(testInstance, getMockAnnotations());
//         for (Field field : fields) {
//             if (field.get(testInstance) != null) {
//                 continue;
//             }
//             final Class<?> type = field.getType();
// 
//             if (field.isAnnotationPresent(org.mockito.Mock.class)) {
//                 org.mockito.Mock mockAnnotation = field.getAnnotation(org.mockito.Mock.class);
//                 MockSettings mockSettings = withSettings();
//                 Answers answers = mockAnnotation.answer();
//                 if (answers != null) {
//                     mockSettings.defaultAnswer(answers);
//                 }
// 
//                 Class<?>[] extraInterfaces = mockAnnotation.extraInterfaces();
//                 if (extraInterfaces != null && extraInterfaces.length > 0) {
//                     mockSettings.extraInterfaces(extraInterfaces);
//                 }
// 
//                 String name = mockAnnotation.name();
//                 if (name != null && name.length() > 0) {
//                     mockSettings.name(name);
//                 }
// 
//                 field.set(testInstance, mock(type, mockSettings));
//             } else {
//                 field.set(testInstance, mock(type));
//             }
//         }
//     }
// 
//     @SuppressWarnings("unchecked")
//     @Override
//     public Class<? extends Annotation>[] getMockAnnotations() {
//         return new Class[]{org.mockito.Mock.class, Mock.class};
//     }
// 
//     private Object processAnnotationOn(Captor annotation, Field field) {
//         Class<?> type = field.getType();
//         if (!ArgumentCaptor.class.isAssignableFrom(type)) {
//             throw new MockitoException("@Captor field must be of the type ArgumentCaptor.\n" + "Field: '"
//                     + field.getName() + "' has wrong type\n"
//                     + "For info how to use @Captor annotations see examples in javadoc for MockitoAnnotations class.");
//         }
//         Class cls = new GenericMaster().getGenericType(field);
//         return ArgumentCaptor.forClass(cls);
//     }
// }
// 
// Path: powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/PowerMockRunner.java
// public class PowerMockRunner extends AbstractCommonPowerMockRunner {
// 
//     public PowerMockRunner(Class<?> klass) throws Exception {
//         super(klass, getRunnerDelegateImplClass(klass));
//     }
//     
//     private static Class<? extends PowerMockJUnitRunnerDelegate> getRunnerDelegateImplClass(Class<?> klass) {
//         if (klass.isAnnotationPresent(PowerMockRunnerDelegate.class)
//                 || Boolean.getBoolean("powermock.implicitDelegateAnnotation")) {
//             return DelegatingPowerMockRunner.class;
//         }
// 
//         Class<? extends PowerMockJUnitRunnerDelegate> concreteClass = PowerMockJUnit44RunnerDelegateImpl.class;
//         if(JUnitVersion.isGreaterThanOrEqualTo("4.9")) {
//                    concreteClass = PowerMockJUnit49RunnerDelegateImpl.class;
//         } else if( JUnitVersion.isGreaterThanOrEqualTo("4.7") ) {
//             concreteClass = PowerMockJUnit47RunnerDelegateImpl.class;
//         }
//         return concreteClass;
//     }
// 
//     /**
//      * Clean up some state to avoid OOM issues
//      */
//     @Override
//     public void run(RunNotifier notifier) {
//         Description description = getDescription();
//         try {
//             super.run(notifier);
//         } finally {
//             Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{});
//         }
//     }
// }


// Path: tests/easymock/junit412/src/test/java/samples/junit412/github668/TwoMockFieldsWithSameTypeCase.java
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.annotation.Mock;
import org.powermock.api.extension.listener.AnnotationEnabler;
import org.powermock.core.classloader.annotations.PowerMockListener;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.easymock.EasyMock.expect;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.powermock.api.easymock.PowerMock.replayAll;

package samples.junit412.github668;




/**
 *
 */
@RunWith(PowerMockRunner.class)
@PowerMockListener(AnnotationEnabler.class)
public class TwoMockFieldsWithSameTypeCase {

    @Mock(fieldName = "incidentPropertyChangeDAO")
    private IncidentPropertyChangeDAO incidentPropertyChangeDAO;