@Subscribe
    public void handleUserDeletedEvent(UserDeletedEvent event) {
        final Set<GRN> grantees;
        try (final Stream<GrantDTO> grantStream = grantService.streamAll()) {
            grantees = grantStream
                    .map(GrantDTO::grantee)
                    .filter(grantee -> grantee.grnType().equals(GRNTypes.USER))
                    .collect(Collectors.toSet());
        }

        final Set<GRN> users;
        try (final Stream<UserOverviewDTO> userStream = userService.streamAll()) {
            users = userStream
                    .map(user -> grnRegistry.newGRN(GRNTypes.USER.type(), user.id()))
                    .collect(Collectors.toSet());
        }

        final Sets.SetView<GRN> removedGrantees = Sets.difference(grantees, users);

        if (!removedGrantees.isEmpty()) {
            log.debug("Clearing grants for {} grantees ({}).", removedGrantees.size(), removedGrantees);
            removedGrantees.forEach(grantService::deleteForGrantee);
        }
    }
@Test
    void noGrants() {
        when(userService.streamAll()).thenReturn(Stream.of(userA));
        when(grantService.streamAll()).thenReturn(Stream.empty());

        cleanupListener.handleUserDeletedEvent(mock(UserDeletedEvent.class));

        verify(grantService, never()).deleteForGrantee(any());
    }