public static <T extends PipelineOptions> T as(Class<T> klass) {
    return new Builder().as(klass);
  }
@Test
  public void testGettersAnnotatedWithInconsistentDefault() throws Exception {
    // Initial construction is valid.
    GetterWithDefault options = PipelineOptionsFactory.as(GetterWithDefault.class);

    expectedException.expect(IllegalArgumentException.class);

    // Make sure the error message says what the problem is, generally
    expectedException.expectMessage("contradictory annotations");

    // Make sure the error message gives actionable details about what
    // annotations were contradictory.
    // Note that the quotes in the unparsed string are present in Java 11 but absent in Java 8
    expectedException.expectMessage(
        anyOf(
            containsString("Default.String(value=\"abc\")"),
            containsString("Default.String(value=abc)")));
    expectedException.expectMessage("Default.Integer(value=1");

    // When we attempt to convert, we should error at this moment.
    options.as(GetterWithInconsistentDefaultType.class);
  }