### Question:
DefaultEventAdmin implements EventAdmin, Closeable { @Override public void sendEvent(final Event event) { final TopicPermission permission = new TopicPermission(event.getTopic(), SUBSCRIBE); listeners.stream() .filter(l -> l.topics == null || l.bundle.hasPermission(permission)) .filter(l -> l.matches(event)) .forEach(l -> l.handler.handleEvent(event)); } DefaultEventAdmin(final Collection<EventHandlerInstance> listeners,
                             final int poolSize); @Override void postEvent(final Event event); @Override void sendEvent(final Event event); @Override void close();  }### Answer:
@Test void publish() { final BundleRegistry registry = new BundleRegistry(new OSGiServices(null, emptyList(), emptyList()), new Ripener.Configuration()); final BundleImpl bundle = registry.getBundles().values().iterator().next().getBundle(); final List<DefaultEventAdmin.EventHandlerInstance> listeners = new ArrayList<>(); final Collection<String> events = new ArrayList<>(); try (final DefaultEventAdmin admin = new DefaultEventAdmin(listeners, 1)) { listeners.add(new DefaultEventAdmin.EventHandlerInstance(bundle, event -> events.add(asString(event)), new String[] { "test" }, null)); admin.sendEvent(new Event("test", singletonMap("winegrower", "1"))); assertEquals(singletonList("@test: event.topics=test, winegrower=1"), events); admin.sendEvent(new Event("test/another", singletonMap("weingrower", "2"))); assertEquals(2, events.size()); listeners.add(new DefaultEventAdmin.EventHandlerInstance(bundle, event -> events.add(asString(event)), new String[] { "test" }, "(&(winegrower=4)(event.topics=test))")); admin.sendEvent(new Event("test/no", singletonMap("weingrower", "3"))); assertEquals(3, events.size()); admin.sendEvent(new Event("test", singletonMap("weingrower", "4"))); assertEquals(4, events.size()); admin.sendEvent(new Event("test/single", singletonMap("weingrower", "4"))); assertEquals(5, events.size()); } }