@SuppressWarnings("unchecked")
  public DynamicDestinations<UserT, DestinationT, OutputT> getDynamicDestinations() {
    return (DynamicDestinations<UserT, DestinationT, OutputT>) dynamicDestinations;
  }
@Test
  public void testGenerateOutputFilenames() {
    List<ResourceId> expected;
    List<ResourceId> actual;
    ResourceId root = getBaseOutputDirectory();

    SimpleSink<Void> sink =
        SimpleSink.makeSimpleSink(
            root, "file", ".SSSSS.of.NNNNN", ".test", Compression.UNCOMPRESSED);
    FilenamePolicy policy = sink.getDynamicDestinations().getFilenamePolicy(null);

    expected =
        Arrays.asList(
            root.resolve("file.00000.of.00003.test", StandardResolveOptions.RESOLVE_FILE),
            root.resolve("file.00001.of.00003.test", StandardResolveOptions.RESOLVE_FILE),
            root.resolve("file.00002.of.00003.test", StandardResolveOptions.RESOLVE_FILE));
    actual = generateDestinationFilenames(policy, 3);
    assertEquals(expected, actual);

    expected =
        Collections.singletonList(
            root.resolve("file.00000.of.00001.test", StandardResolveOptions.RESOLVE_FILE));
    actual = generateDestinationFilenames(policy, 1);
    assertEquals(expected, actual);

    expected = new ArrayList<>();
    actual = generateDestinationFilenames(policy, 0);
    assertEquals(expected, actual);
  }