ThriftServiceUtils { static Set<String> serviceNames(HttpService service) { if (thriftServiceClass == null || entriesMethod == null || interfacesMethod == null) { return ImmutableSet.of(); } final Object thriftService = service.as(thriftServiceClass); if (thriftService == null) { return ImmutableSet.of(); } @SuppressWarnings("unchecked") final Map<String, ?> entries = (Map<String, ?>) invokeMethod(entriesMethod, thriftService); assert entries != null; return toServiceName(entries.values()); } private  ThriftServiceUtils();   }
@Test void serviceNames() { assertThat(ThriftServiceUtils.serviceNames(THttpService.of(asyncService))) .isEqualTo(ImmutableSet.of(SERVICE_NAME)); assertThat(ThriftServiceUtils.serviceNames(THttpService.builder() .addService("async", asyncService) .addService("sync", syncService).build())) .isEqualTo(ImmutableSet.of(SERVICE_NAME)); }