public static <T extends PipelineOptions> T as(Class<T> klass) {
    return new Builder().as(klass);
  }
@Test
  public void testAllFromPipelineOptions() {
    // TODO: Java core test failing on windows, https://github.com/apache/beam/issues/20466
    assumeFalse(SystemUtils.IS_OS_WINDOWS);
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage(
        "All inherited interfaces of"
            + " [org.apache.beam.sdk.options.PipelineOptionsFactoryTest$PipelineOptionsInheritedInvalid]"
            + " should inherit from the PipelineOptions interface. The following inherited"
            + " interfaces do not:\n"
            + " - org.apache.beam.sdk.options.PipelineOptionsFactoryTest$InvalidPipelineOptions1\n"
            + " - org.apache.beam.sdk.options.PipelineOptionsFactoryTest$InvalidPipelineOptions2");

    PipelineOptionsFactory.as(PipelineOptionsInheritedInvalid.class);
  }