public static String clientIdBase(WorkerConfig config) {
        String result = Optional.ofNullable(config.groupId())
                .orElse("connect");
        String userSpecifiedClientId = config.getString(CLIENT_ID_CONFIG);
        if (userSpecifiedClientId != null && !userSpecifiedClientId.trim().isEmpty()) {
            result += "-" + userSpecifiedClientId;
        }
        return result + "-";
    }
@Test
    public void testClientIdBase() {
        String groupId = "connect-cluster";
        String userSpecifiedClientId = "worker-57";

        String expectedClientIdBase = groupId + "-" + userSpecifiedClientId + "-";
        assertClientIdBase(groupId, userSpecifiedClientId, expectedClientIdBase);

        expectedClientIdBase = groupId + "-";
        assertClientIdBase(groupId, null, expectedClientIdBase);

        expectedClientIdBase = "connect-";
        assertClientIdBase(null, null, expectedClientIdBase);

        expectedClientIdBase = "connect-" + userSpecifiedClientId + "-";
        assertClientIdBase(null, userSpecifiedClientId, expectedClientIdBase);

        expectedClientIdBase = "connect-";
        assertClientIdBase(null, "", expectedClientIdBase);
    }