@Test @DisplayName("allow eventFactory of white list type") void acceptAllowed() { EventMessage event = EntProjectCreated.getDefaultInstance(); Optional<? extends Message> result = whiteList.filter(event); assertTrue(result.isPresent()); assertEquals(event, result.get()); }
@Override public Optional<? extends EventMessage> filter(EventMessage event) { EventClass type = EventClass.of(event); return allowedEvents.contains(type) ? Optional.of(event) : Optional.empty(); }
EventWhiteList implements EventFilter { @Override public Optional<? extends EventMessage> filter(EventMessage event) { EventClass type = EventClass.of(event); return allowedEvents.contains(type) ? Optional.of(event) : Optional.empty(); } }
EventWhiteList implements EventFilter { @Override public Optional<? extends EventMessage> filter(EventMessage event) { EventClass type = EventClass.of(event); return allowedEvents.contains(type) ? Optional.of(event) : Optional.empty(); } private  EventWhiteList(ImmutableSet<EventClass> allowedEvents); }
EventWhiteList implements EventFilter { @Override public Optional<? extends EventMessage> filter(EventMessage event) { EventClass type = EventClass.of(event); return allowedEvents.contains(type) ? Optional.of(event) : Optional.empty(); } private  EventWhiteList(ImmutableSet<EventClass> allowedEvents); @SuppressWarnings("WeakerAccess") // Public API of the framework. @SafeVarargs static EventWhiteList allowEvents(Class<? extends EventMessage>... eventClasses); @Override Optional<? extends EventMessage> filter(EventMessage event); }
EventWhiteList implements EventFilter { @Override public Optional<? extends EventMessage> filter(EventMessage event) { EventClass type = EventClass.of(event); return allowedEvents.contains(type) ? Optional.of(event) : Optional.empty(); } private  EventWhiteList(ImmutableSet<EventClass> allowedEvents); @SuppressWarnings("WeakerAccess") // Public API of the framework. @SafeVarargs static EventWhiteList allowEvents(Class<? extends EventMessage>... eventClasses); @Override Optional<? extends EventMessage> filter(EventMessage event);  }