### Question:
BackgroundHiveSplitLoader implements HiveSplitLoader { @VisibleForTesting static OptionalInt getBucketNumber(String name) { for (Pattern pattern : BUCKET_PATTERNS) { Matcher matcher = pattern.matcher(name); if (matcher.matches()) { return OptionalInt.of(parseInt(matcher.group(1))); } } return OptionalInt.empty(); } BackgroundHiveSplitLoader(
            Table table,
            Iterable<HivePartitionMetadata> partitions,
            TupleDomain<? extends ColumnHandle> compactEffectivePredicate,
            DynamicFilter dynamicFilter,
            Duration dynamicFilteringProbeBlockingTimeout,
            TypeManager typeManager,
            Optional<BucketSplitInfo> tableBucketInfo,
            ConnectorSession session,
            HdfsEnvironment hdfsEnvironment,
            NamenodeStats namenodeStats,
            DirectoryLister directoryLister,
            Executor executor,
            int loaderConcurrency,
            boolean recursiveDirWalkerEnabled,
            boolean ignoreAbsentPartitions,
            Optional<ValidWriteIdList> validWriteIds); @Override void start(HiveSplitSource splitSource); @Override void stop(); static boolean hasAttemptId(String bucketFilename);  }### Answer:
@Test public void testGetBucketNumber() { assertEquals(getBucketNumber("20190526_072952_00009_fn7s5_bucket-00234"), OptionalInt.of(234)); assertEquals(getBucketNumber("20190526_072952_00009_fn7s5_bucket-00234.txt"), OptionalInt.of(234)); assertEquals(getBucketNumber("20190526_235847_87654_fn7s5_bucket-56789"), OptionalInt.of(56789)); assertEquals(getBucketNumber("0234_0"), OptionalInt.of(234)); assertEquals(getBucketNumber("000234_0"), OptionalInt.of(234)); assertEquals(getBucketNumber("0234_99"), OptionalInt.of(234)); assertEquals(getBucketNumber("0234_0.txt"), OptionalInt.of(234)); assertEquals(getBucketNumber("0234_0_copy_1"), OptionalInt.of(234)); assertEquals(getBucketNumber("234_99"), OptionalInt.of(234)); assertEquals(getBucketNumber("1234_0_copy_1"), OptionalInt.of(1234)); assertEquals(getBucketNumber("bucket_1234"), OptionalInt.of(1234)); assertEquals(getBucketNumber("bucket_01234"), OptionalInt.of(1234)); assertEquals(getBucketNumber("0234.txt"), OptionalInt.empty()); assertEquals(getBucketNumber("0234.txt"), OptionalInt.empty()); }