public static WindowMappingFn<?> windowMappingFnFromProto(RunnerApi.FunctionSpec windowMappingFn)
      throws InvalidProtocolBufferException {
    RunnerApi.FunctionSpec spec = windowMappingFn;
    checkArgument(
        spec.getUrn().equals(ParDoTranslation.CUSTOM_JAVA_WINDOW_MAPPING_FN_URN),
        "Can't deserialize unknown %s type %s",
        WindowMappingFn.class.getSimpleName(),
        spec.getUrn());
    return (WindowMappingFn<?>)
        SerializableUtils.deserializeFromByteArray(
            spec.getPayload().toByteArray(), "Custom WinodwMappingFn");
  }
@Test
  public void testWindowMappingFnTranslation() throws Exception {
    SdkComponents sdkComponents = SdkComponents.create();
    sdkComponents.registerEnvironment(Environments.createDockerEnvironment("java"));
    assertEquals(
        new GlobalWindows().getDefaultWindowMappingFn(),
        PCollectionViewTranslation.windowMappingFnFromProto(
            ParDoTranslation.translateWindowMappingFn(
                new GlobalWindows().getDefaultWindowMappingFn(), sdkComponents)));
  }