public void submitLoggingTask(Collection<Member> connectedMembers, Collection<Member> allMembers) {
        if (delayPeriodSeconds <= 0) {
            return;
        }

        if ((submittedLoggingTask != null && !submittedLoggingTask.isDone())) {
            submittedLoggingTask.cancel(true);
        }

        submittedLoggingTask = executor.schedule(()
                        -> logger.info(connectivityLog(connectedMembers, allMembers)),
                delayPeriodSeconds, SECONDS);

    }
@Test
    void assertLogMessageIsCorrect() {
        List<Member> mockMembers = createMockMembers(2);
        HazelcastProperties hzProps = createMockProperties(1);
        ClientConnectivityLogger clientConnectivityLogger = new ClientConnectivityLogger(loggingService, executor, hzProps);

        clientConnectivityLogger.submitLoggingTask(List.of(mockMembers.get(0)), mockMembers);

        String expected = format(System.lineSeparator()
                        + System.lineSeparator()
                        + "Client Connectivity [2] {"
                        + System.lineSeparator()
                        + "\t%s - connected"
                        + System.lineSeparator()
                        + "\t%s - disconnected"
                        + System.lineSeparator()
                        + "}"
                        + System.lineSeparator(),
                mockMembers.get(0),
                mockMembers.get(1)
        );

        ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);
        verify(executor).schedule(runnableCaptor.capture(), anyLong(), any());

        runnableCaptor.getValue().run();
        verify(logger).info(expected);
    }