@Override
    public boolean alterOffsets(Map<String, String> connectorConfig, Map<Map<String, ?>, Map<String, ?>> offsets) {
        AbstractConfig config = new AbstractConfig(CONFIG_DEF, connectorConfig);
        String filename = config.getString(FILE_CONFIG);
        if (filename == null || filename.isEmpty()) {
            throw new ConnectException("Offsets cannot be modified if the '" + FILE_CONFIG + "' configuration is unspecified. " +
                    "This is because stdin is used for input and offsets are not tracked.");
        }

        // This connector makes use of a single source partition at a time which represents the file that it is configured to read from.
        // However, there could also be source partitions from previous configurations of the connector.
        for (Map.Entry<Map<String, ?>, Map<String, ?>> partitionOffset : offsets.entrySet()) {
            Map<String, ?> offset = partitionOffset.getValue();
            if (offset == null) {
                // We allow tombstones for anything; if there's garbage in the offsets for the connector, we don't
                // want to prevent users from being able to clean it up using the REST API
                continue;
            }

            if (!offset.containsKey(POSITION_FIELD)) {
                throw new ConnectException("Offset objects should either be null or contain the key '" + POSITION_FIELD + "'");
            }

            // The 'position' in the offset represents the position in the file's byte stream and should be a non-negative long value
            if (!(offset.get(POSITION_FIELD) instanceof Long)) {
                throw new ConnectException("The value for the '" + POSITION_FIELD + "' key in the offset is expected to be a Long value");
            }

            long offsetPosition = (Long) offset.get(POSITION_FIELD);
            if (offsetPosition < 0) {
                throw new ConnectException("The value for the '" + POSITION_FIELD + "' key in the offset should be a non-negative value");
            }

            Map<String, ?> partition = partitionOffset.getKey();
            if (partition == null) {
                throw new ConnectException("Partition objects cannot be null");
            }

            if (!partition.containsKey(FILENAME_FIELD)) {
                throw new ConnectException("Partition objects should contain the key '" + FILENAME_FIELD + "'");
            }
        }

        // Let the task check whether the actual value for the offset position is valid for the configured file on startup
        return true;
    }
@Test
    public void testAlterOffsetsStdin() {
        sourceProperties.remove(FileStreamSourceConnector.FILE_CONFIG);
        Map<Map<String, ?>, Map<String, ?>> offsets = Collections.singletonMap(
                Collections.singletonMap(FILENAME_FIELD, FILENAME),
                Collections.singletonMap(POSITION_FIELD, 0L)
        );
        assertThrows(ConnectException.class, () -> connector.alterOffsets(sourceProperties, offsets));
    }