public static <InputT, OutputT> DoFnInvoker<InputT, OutputT> invokerFor(
      DoFn<InputT, OutputT> fn) {
    return ByteBuddyDoFnInvokerFactory.only().newByteBuddyInvoker(fn);
  }
@Test
  public void testGetSize() throws Exception {
    abstract class MockFn extends DoFn<String, String> {
      @ProcessElement
      public abstract void processElement(
          ProcessContext c, RestrictionTracker<RestrictionWithBoundedDefaultTracker, Void> tracker);

      @GetInitialRestriction
      public abstract RestrictionWithBoundedDefaultTracker getInitialRestriction(
          @Element String element);

      @GetSize
      public abstract double getSize();
    }

    MockFn fn = mock(MockFn.class);
    when(fn.getSize()).thenReturn(5.0, -3.0);

    DoFnInvoker<String, String> invoker = DoFnInvokers.invokerFor(fn);
    assertEquals(5.0, invoker.invokeGetSize(mockArgumentProvider), 0.0001);
    assertThrows(
        "Expected size >= 0 but received",
        IllegalArgumentException.class,
        () -> invoker.invokeGetSize(mockArgumentProvider));
  }