### Question:
GcListener implements NotificationListener, NotificationFilter { @Override public boolean isNotificationEnabled(Notification notification) { return notification.getType().equals(gcNotificationName); } GcListener(
        Log log,
        AtomicLong freeMemory,
        String[] poolNames,
        String gcNotificationName,
        MethodHandle getMemoryUsage
    ); @Override boolean isNotificationEnabled(Notification notification); @Override void handleNotification(Notification notification, Object handback);  }### Answer:
@Test void testFilter() { NotificationFilter listener = new GcListener( NullLog.getInstance(), new AtomicLong(-1), new String[0], "some-name-42", MethodHandles.identity(Void.class) ); Notification acceptedNotification = new Notification("some-name-42", "1337", 1337); assertTrue(listener.isNotificationEnabled(acceptedNotification)); Notification ignoredNotification = new Notification("some-name-1337", "1337", 1337); assertFalse(listener.isNotificationEnabled(ignoredNotification)); }