@Test
public void testNamesAreCached() throws Exception {

  class Test {
    @SuppressWarnings("unused")
    public void foo(
        @Nullable @Named("foo1") String f1,
        @Nullable @Named("foo2") String f2,
        @Nullable @Named("foo3") String f3) {}
  }
  Method method = Test.class.getDeclaredMethod("foo", String.class, String.class, String.class);
  EndpointMethod endpointMethod = EndpointMethod.create(method.getDeclaringClass(), method);
  readParameters("{}", endpointMethod);
  List<String> parameterNames = endpointMethod.getParameterNames();
  assertEquals(3, parameterNames.size());
  assertEquals("foo1", parameterNames.get(0));
  assertEquals("foo2", parameterNames.get(1));
  assertEquals("foo3", parameterNames.get(2));
}