// Path: src/main/java/org/pdfsam/eventstudio/Annotations.java
// static class ReflectiveListenerDescriptor {
// 
//     private final EventListener listenerAnnotation;
//     private final Method method;
// 
//     public ReflectiveListenerDescriptor(EventListener listenerAnnotation, Method method) {
//         this.listenerAnnotation = listenerAnnotation;
//         this.method = method;
//     }
// 
//     public EventListener getListenerAnnotation() {
//         return listenerAnnotation;
//     }
// 
//     public Method getMethod() {
//         return method;
//     }
// }
// 
// Path: src/main/java/org/pdfsam/eventstudio/Annotations.java
// static class ReflectiveMetadata {
//     private String station;
//     private final Map<String, List<ReflectiveListenerDescriptor>> descriptors = new HashMap<>();
// 
//     private void put(String station, ReflectiveListenerDescriptor descriptor) {
//         List<ReflectiveListenerDescriptor> current = descriptors.computeIfAbsent(station, k -> new ArrayList<>());
//         current.add(descriptor);
//     }
// 
//     public String getStation() {
//         return station;
//     }
// 
//     public Map<String, List<ReflectiveListenerDescriptor>> getDescriptors() {
//         return descriptors;
//     }
// 
// }
// 
// Path: src/main/java/org/pdfsam/eventstudio/Listeners.java
// static class ListenerReferenceHolder implements Comparable<ListenerReferenceHolder> {
//     int priority = 0;
//     private final Entity<? extends ListenerWrapper> reference;
// 
//     public ListenerReferenceHolder(int priority, Entity<? extends ListenerWrapper> reference) {
//         requireNotNull(reference);
//         this.priority = priority;
//         this.reference = reference;
//     }
// 
//     public int compareTo(ListenerReferenceHolder o) {
//         if (this.priority < o.priority) {
//             return -1;
//         }
//         if (this.priority > o.priority) {
//             return 1;
//         }
//         // same priority
//         int retVal = this.hashCode() - o.hashCode();
//         // same hashcode but not equals. This shouldn't happen but according
//         // to hascode documentation is not required and since we don't want
//         // ListenerReferenceHolder to
//         // disappear from the TreeSet we return an arbitrary integer != from
//         // 0
//         if (retVal == 0 && !this.equals(o)) {
//             retVal = -1;
//         }
//         return retVal;
//     }
// 
//     public ListenerWrapper getListenerWrapper() {
//         return reference.get();
//     }
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.pdfsam.eventstudio.Annotations.ReflectiveListenerDescriptor;
import org.pdfsam.eventstudio.Annotations.ReflectiveMetadata;
import org.pdfsam.eventstudio.Listeners.ListenerReferenceHolder;
import org.pdfsam.eventstudio.annotation.EventListener;
    public void remove() {
        TestListener listener = new TestListener();
        assertTrue(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        victim.add(TestEvent.class, listener, 0, ReferenceStrength.STRONG);
        assertFalse(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        victim.remove(TestEvent.class, listener);
        assertTrue(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
    }

    @Test
    public void removeMany() {
        TestListener listener = new TestListener();
        SecondTestListener listener2 = new SecondTestListener();
        AnotherTestListener anotherListener = new AnotherTestListener();
        victim.add(TestEvent.class, listener, 0, ReferenceStrength.STRONG);
        victim.add(TestEvent.class, listener2, 0, ReferenceStrength.WEAK);
        victim.add(AnotherTestEvent.class, anotherListener, 0, ReferenceStrength.SOFT);
        assertFalse(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        assertFalse(victim.nullSafeGetListeners(AnotherTestEvent.class).isEmpty());
        assertTrue(victim.remove(TestEvent.class, listener2));
        assertTrue(victim.remove(AnotherTestEvent.class, anotherListener));
        assertTrue(victim.nullSafeGetListeners(AnotherTestEvent.class).isEmpty());
        assertEquals(1, victim.nullSafeGetListeners(TestEvent.class).size());
    }

    @Test
    public void removeHolder() {
        TestListener listener = new TestListener();
        assertTrue(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        victim.add(TestEvent.class, listener, 0, ReferenceStrength.STRONG);
// Path: src/main/java/org/pdfsam/eventstudio/Annotations.java
// static class ReflectiveListenerDescriptor {
// 
//     private final EventListener listenerAnnotation;
//     private final Method method;
// 
//     public ReflectiveListenerDescriptor(EventListener listenerAnnotation, Method method) {
//         this.listenerAnnotation = listenerAnnotation;
//         this.method = method;
//     }
// 
//     public EventListener getListenerAnnotation() {
//         return listenerAnnotation;
//     }
// 
//     public Method getMethod() {
//         return method;
//     }
// }
// 
// Path: src/main/java/org/pdfsam/eventstudio/Annotations.java
// static class ReflectiveMetadata {
//     private String station;
//     private final Map<String, List<ReflectiveListenerDescriptor>> descriptors = new HashMap<>();
// 
//     private void put(String station, ReflectiveListenerDescriptor descriptor) {
//         List<ReflectiveListenerDescriptor> current = descriptors.computeIfAbsent(station, k -> new ArrayList<>());
//         current.add(descriptor);
//     }
// 
//     public String getStation() {
//         return station;
//     }
// 
//     public Map<String, List<ReflectiveListenerDescriptor>> getDescriptors() {
//         return descriptors;
//     }
// 
// }
// 
// Path: src/main/java/org/pdfsam/eventstudio/Listeners.java
// static class ListenerReferenceHolder implements Comparable<ListenerReferenceHolder> {
//     int priority = 0;
//     private final Entity<? extends ListenerWrapper> reference;
// 
//     public ListenerReferenceHolder(int priority, Entity<? extends ListenerWrapper> reference) {
//         requireNotNull(reference);
//         this.priority = priority;
//         this.reference = reference;
//     }
// 
//     public int compareTo(ListenerReferenceHolder o) {
//         if (this.priority < o.priority) {
//             return -1;
//         }
//         if (this.priority > o.priority) {
//             return 1;
//         }
//         // same priority
//         int retVal = this.hashCode() - o.hashCode();
//         // same hashcode but not equals. This shouldn't happen but according
//         // to hascode documentation is not required and since we don't want
//         // ListenerReferenceHolder to
//         // disappear from the TreeSet we return an arbitrary integer != from
//         // 0
//         if (retVal == 0 && !this.equals(o)) {
//             retVal = -1;
//         }
//         return retVal;
//     }
// 
//     public ListenerWrapper getListenerWrapper() {
//         return reference.get();
//     }
// }


// Path: src/test/java/org/pdfsam/eventstudio/ListenersTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.pdfsam.eventstudio.Annotations.ReflectiveListenerDescriptor;
import org.pdfsam.eventstudio.Annotations.ReflectiveMetadata;
import org.pdfsam.eventstudio.Listeners.ListenerReferenceHolder;
import org.pdfsam.eventstudio.annotation.EventListener;

    public void remove() {
        TestListener listener = new TestListener();
        assertTrue(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        victim.add(TestEvent.class, listener, 0, ReferenceStrength.STRONG);
        assertFalse(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        victim.remove(TestEvent.class, listener);
        assertTrue(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
    }

    @Test
    public void removeMany() {
        TestListener listener = new TestListener();
        SecondTestListener listener2 = new SecondTestListener();
        AnotherTestListener anotherListener = new AnotherTestListener();
        victim.add(TestEvent.class, listener, 0, ReferenceStrength.STRONG);
        victim.add(TestEvent.class, listener2, 0, ReferenceStrength.WEAK);
        victim.add(AnotherTestEvent.class, anotherListener, 0, ReferenceStrength.SOFT);
        assertFalse(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        assertFalse(victim.nullSafeGetListeners(AnotherTestEvent.class).isEmpty());
        assertTrue(victim.remove(TestEvent.class, listener2));
        assertTrue(victim.remove(AnotherTestEvent.class, anotherListener));
        assertTrue(victim.nullSafeGetListeners(AnotherTestEvent.class).isEmpty());
        assertEquals(1, victim.nullSafeGetListeners(TestEvent.class).size());
    }

    @Test
    public void removeHolder() {
        TestListener listener = new TestListener();
        assertTrue(victim.nullSafeGetListeners(TestEvent.class).isEmpty());
        victim.add(TestEvent.class, listener, 0, ReferenceStrength.STRONG);
        for (ListenerReferenceHolder holder : victim.nullSafeGetListeners(TestEvent.class)) {