GRPCExporter extends MetricFormatter implements MetricValuesExportService, IConsumer<ExportData> { public void initSubscriptionList() { SubscriptionsResp subscription = blockingStub.withDeadlineAfter(10, TimeUnit.SECONDS) .subscription(SubscriptionReq.newBuilder().build()); subscription.getMetricNamesList().forEach(subscriptionSet::add); LOGGER.debug("Get exporter subscription list, {}", subscriptionSet); } GRPCExporter(GRPCExporterSetting setting); @Override void export(ExportEvent event); void initSubscriptionList(); @Override void init(); @Override void consume(List<ExportData> data); @Override void onError(List<ExportData> data, Throwable t); @Override void onExit();  }
@Test public void initSubscriptionList() { Whitebox.setInternalState(exporter, "blockingStub", stub); exporter.initSubscriptionList(); }