@Override
    public void collectSizeStats(StateObjectSizeStatsCollector collector) {
        final StateObjectLocation location;
        if (NOT_LOCAL_FILER.matcher(filePath.toUri().toString()).matches()) {
            location = StateObjectLocation.REMOTE;
        } else {
            location = StateObjectLocation.LOCAL_DISK;
        }
        collector.add(location, getStateSize());
    }
@Test
    void testCollectSizeStats() throws Exception {
        final long stateSize = 123L;

        StateObject.StateObjectSizeStatsCollector statsCollector =
                StateObject.StateObjectSizeStatsCollector.create();
        FileStateHandle handle =
                new FileStateHandle(new Path(new URI("file:///home/test.txt")), stateSize);
        handle.collectSizeStats(statsCollector);
        checkStats(statsCollector, StateObject.StateObjectLocation.LOCAL_DISK, stateSize);

        statsCollector = StateObject.StateObjectSizeStatsCollector.create();
        handle = new FileStateHandle(new Path(new URI("/home/test.txt")), stateSize);
        handle.collectSizeStats(statsCollector);
        checkStats(statsCollector, StateObject.StateObjectLocation.LOCAL_DISK, stateSize);

        statsCollector = StateObject.StateObjectSizeStatsCollector.create();
        handle = new FileStateHandle(new Path(new URI("s3:///folder/test.txt")), stateSize);
        handle.collectSizeStats(statsCollector);
        checkStats(statsCollector, StateObject.StateObjectLocation.REMOTE, stateSize);
    }